Skip to content

Commit

Permalink
Adding name spacing to ApolloAPI.Object (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobaFetters committed Oct 23, 2023
1 parent 53d61f3 commit 42671a4
Show file tree
Hide file tree
Showing 257 changed files with 302 additions and 264 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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 } } }"#,
#"query DogQuery { allAnimals { __typename id skinCovering ... on Dog { ...DogFragment houseDetails } } }"#,
fragments: [DogFragment.self]
))

Expand Down Expand Up @@ -85,9 +85,11 @@ public class DogQuery: GraphQLQuery {
public typealias RootEntityType = DogQuery.Data.AllAnimal
public static var __parentType: ApolloAPI.ParentType { AnimalKingdomAPI.Objects.Dog }
public static var __selections: [ApolloAPI.Selection] { [
.field("houseDetails", AnimalKingdomAPI.Object?.self),
.fragment(DogFragment.self),
] }

public var houseDetails: AnimalKingdomAPI.Object? { __data["houseDetails"] }
public var id: AnimalKingdomAPI.ID { __data["id"] }
public var skinCovering: GraphQLEnum<AnimalKingdomAPI.SkinCovering>? { __data["skinCovering"] }
public var species: String { __data["species"] }
Expand All @@ -100,13 +102,15 @@ public class DogQuery: GraphQLQuery {
}

public init(
houseDetails: AnimalKingdomAPI.Object? = nil,
id: AnimalKingdomAPI.ID,
skinCovering: GraphQLEnum<AnimalKingdomAPI.SkinCovering>? = nil,
species: String
) {
self.init(_dataDict: DataDict(
data: [
"__typename": AnimalKingdomAPI.Objects.Dog.typename,
"houseDetails": houseDetails,
"id": id,
"skinCovering": skinCovering,
"species": species,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @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 Object = String
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Bird = Object(
static let Bird = ApolloAPI.Object(
typename: "Bird",
implementedInterfaces: [
Interfaces.Animal.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Cat = Object(
static let Cat = ApolloAPI.Object(
typename: "Cat",
implementedInterfaces: [
Interfaces.Animal.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Crocodile = Object(
static let Crocodile = ApolloAPI.Object(
typename: "Crocodile",
implementedInterfaces: [Interfaces.Animal.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Dog = Object(
static let Dog = ApolloAPI.Object(
typename: "Dog",
implementedInterfaces: [
Interfaces.Animal.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Fish = Object(
static let Fish = ApolloAPI.Object(
typename: "Fish",
implementedInterfaces: [
Interfaces.Animal.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Height = Object(
static let Height = ApolloAPI.Object(
typename: "Height",
implementedInterfaces: []
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Human = Object(
static let Human = ApolloAPI.Object(
typename: "Human",
implementedInterfaces: [
Interfaces.Animal.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Mutation = Object(
static let Mutation = ApolloAPI.Object(
typename: "Mutation",
implementedInterfaces: []
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let PetRock = Object(
static let PetRock = ApolloAPI.Object(
typename: "PetRock",
implementedInterfaces: [Interfaces.Pet.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Query = Object(
static let Query = ApolloAPI.Object(
typename: "Query",
implementedInterfaces: []
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ApolloAPI

public extension Objects {
static let Rat = Object(
static let Rat = ApolloAPI.Object(
typename: "Rat",
implementedInterfaces: [
Interfaces.Animal.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ 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? {
public static func objectType(forTypename typename: String) -> ApolloAPI.Object? {
switch typename {
case "Query": return AnimalKingdomAPI.Objects.Query
case "Human": return AnimalKingdomAPI.Objects.Human
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Bird: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Bird
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Bird
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Bird>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Cat: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Cat
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Cat
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Cat>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Crocodile: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Crocodile
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Crocodile
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Crocodile>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Dog: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Dog
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Dog
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Dog>>

Expand All @@ -14,6 +14,7 @@ public class Dog: MockObject {
@Field<Int>("bodyTemperature") public var bodyTemperature
@Field<String>("favoriteToy") public var favoriteToy
@Field<Height>("height") public var height
@Field<AnimalKingdomAPI.Object>("houseDetails") public var houseDetails
@Field<String>("humanName") public var humanName
@Field<AnimalKingdomAPI.ID>("id") public var id
@Field<Bool>("laysEggs") public var laysEggs
Expand All @@ -30,6 +31,7 @@ public extension Mock where O == Dog {
bodyTemperature: Int? = nil,
favoriteToy: String? = nil,
height: Mock<Height>? = nil,
houseDetails: AnimalKingdomAPI.Object? = nil,
humanName: String? = nil,
id: AnimalKingdomAPI.ID? = nil,
laysEggs: Bool? = nil,
Expand All @@ -43,6 +45,7 @@ public extension Mock where O == Dog {
_setScalar(bodyTemperature, for: \.bodyTemperature)
_setScalar(favoriteToy, for: \.favoriteToy)
_setEntity(height, for: \.height)
_setScalar(houseDetails, for: \.houseDetails)
_setScalar(humanName, for: \.humanName)
_setScalar(id, for: \.id)
_setScalar(laysEggs, for: \.laysEggs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Fish: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Fish
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Fish
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Fish>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Height: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Height
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Height
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Height>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Human: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Human
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Human
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Human>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Mutation: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Mutation
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Mutation
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Mutation>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class PetRock: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.PetRock
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.PetRock
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<PetRock>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Query: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Query
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Query
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Query>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloTestSupport
import AnimalKingdomAPI

public class Rat: MockObject {
public static let objectType: Object = AnimalKingdomAPI.Objects.Rat
public static let objectType: ApolloAPI.Object = AnimalKingdomAPI.Objects.Rat
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<Rat>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ type Mutation {

scalar CustomDate

scalar Object

input PetAdoptionInput {
ownerID: ID!
petID: ID!
Expand Down Expand Up @@ -121,6 +123,7 @@ type Dog implements Animal & Pet & HousePet & WarmBlooded {
rival: Cat
livesWith: Bird
birthdate: CustomDate
houseDetails: Object
}

type Bird implements Animal & Pet & WarmBlooded {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ query DogQuery {
skinCovering
... on Dog {
... DogFragment
houseDetails
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// Represents a 'added_to_project' event on a given issue or pull request.
static let AddedToProjectEvent = Object(
static let AddedToProjectEvent = ApolloAPI.Object(
typename: "AddedToProjectEvent",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// A GitHub App.
static let App = Object(
static let App = ApolloAPI.Object(
typename: "App",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// Represents an 'assigned' event on any assignable object.
static let AssignedEvent = Object(
static let AssignedEvent = ApolloAPI.Object(
typename: "AssignedEvent",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// Represents a 'automatic_base_change_failed' event on a given pull request.
static let AutomaticBaseChangeFailedEvent = Object(
static let AutomaticBaseChangeFailedEvent = ApolloAPI.Object(
typename: "AutomaticBaseChangeFailedEvent",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// Represents a 'automatic_base_change_succeeded' event on a given pull request.
static let AutomaticBaseChangeSucceededEvent = Object(
static let AutomaticBaseChangeSucceededEvent = ApolloAPI.Object(
typename: "AutomaticBaseChangeSucceededEvent",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// Represents a 'base_ref_changed' event on a given issue or pull request.
static let BaseRefChangedEvent = Object(
static let BaseRefChangedEvent = ApolloAPI.Object(
typename: "BaseRefChangedEvent",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// Represents a 'base_ref_force_pushed' event on a given pull request.
static let BaseRefForcePushedEvent = Object(
static let BaseRefForcePushedEvent = ApolloAPI.Object(
typename: "BaseRefForcePushedEvent",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// Represents a Git blob.
static let Blob = Object(
static let Blob = ApolloAPI.Object(
typename: "Blob",
implementedInterfaces: [
Interfaces.GitObject.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// A special type of user which takes actions on behalf of GitHub Apps.
static let Bot = Object(
static let Bot = ApolloAPI.Object(
typename: "Bot",
implementedInterfaces: [
Interfaces.Actor.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ApolloAPI

public extension Objects {
/// A branch protection rule.
static let BranchProtectionRule = Object(
static let BranchProtectionRule = ApolloAPI.Object(
typename: "BranchProtectionRule",
implementedInterfaces: [Interfaces.Node.self]
)
Expand Down

0 comments on commit 42671a4

Please sign in to comment.