-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for adding basic input types to the schema via an InputOb… (
#11) * Add support for adding basic input types to the schema via an InputObjectTypeBuilder * Update .travis.yml based on GraphQLSwift/GraphQL setup
- Loading branch information
1 parent
5db60d7
commit 5ddeef6
Showing
4 changed files
with
131 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
notifications: | ||
slack: zewo:VjyVCCQvTOw9yrbzQysZezD1 | ||
os: | ||
- linux | ||
- osx | ||
language: generic | ||
sudo: required | ||
dist: trusty | ||
osx_image: xcode8 | ||
install: | ||
- eval "$(curl -sL https://raw.githubusercontent.com/Zewo/Zewo/master/Scripts/Travis/install.sh)" | ||
matrix: | ||
include: | ||
- os: osx | ||
env: JOB=SwiftPM_OSX | ||
osx_image: xcode8.3 | ||
- os: linux | ||
env: JOB=SwiftPM_linux | ||
dist: trusty | ||
sudo: required | ||
install: | ||
- travis_retry eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" | ||
script: | ||
- bash <(curl -s https://raw.githubusercontent.com/Zewo/Zewo/master/Scripts/Travis/build-test.sh) Graphiti | ||
#after_success: | ||
- bash <(curl -s https://raw.githubusercontent.com/Zewo/Zewo/master/Scripts/Travis/report-coverage.sh) | ||
- swift build -c release | ||
- swift build | ||
- swift test | ||
- eval "$(curl -sL https://raw.githubusercontent.com/lgaches/swifttravisci/master/codecov)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import GraphQL | ||
|
||
public final class InputObjectTypeBuilder<Root, Context, Type> { | ||
var schema: SchemaBuilder<Root, Context> | ||
|
||
init(schema: SchemaBuilder<Root, Context>) { | ||
self.schema = schema | ||
} | ||
|
||
public var description: String? = nil | ||
|
||
var fields: InputObjectConfigFieldMap = [:] | ||
|
||
/// Export all properties using reflection | ||
/// | ||
/// - Throws: Reflection Errors | ||
public func exportFields() throws { | ||
for property in try properties(Type.self) { | ||
let field = InputObjectField(type: try schema.getInputType(from: property.type, field: property.key)) | ||
fields[property.key] = field | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters