Skip to content

Commit 3ec7bf9

Browse files
Merge pull request #155 from NeedleInAJayStack/docs/readme-badges
docs: Updates readme badges
2 parents 3949cc2 + bd3da59 commit 3ec7bf9

File tree

10 files changed

+73
-71
lines changed

10 files changed

+73
-71
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
Graphiti is a Swift library for building GraphQL schemas fast, safely and easily.
44

5-
[![Swift][swift-badge]][swift-url]
5+
[![Platforms][platforms-badge]][platforms-url]
6+
[![Versions][versions-badge]][versions-url]
67
[![License][mit-badge]][mit-url]
78
[![GitHub Actions][gh-actions-badge]][gh-actions-url]
8-
[![Maintainability][maintainability-badge]][maintainability-url]
9-
[![Coverage][coverage-badge]][coverage-url]
109

1110
Looking for help? Find resources [from the community](http://graphql.org/community/).
1211

@@ -249,6 +248,12 @@ swiftformat .
249248

250249
This project is released under the MIT license. See [LICENSE](LICENSE) for details.
251250

251+
[platforms-badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FGraphQLSwift%2FGraphiti%2Fbadge%3Ftype%3Dplatforms
252+
[platforms-url]: https://swiftpackageindex.com/GraphQLSwift/Graphiti
253+
254+
[versions-badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FGraphQLSwift%2FGraphiti%2Fbadge%3Ftype%3Dswift-versions
255+
[versions-url]: https://swiftpackageindex.com/GraphQLSwift/Graphiti
256+
252257
[swift-badge]: https://img.shields.io/badge/Swift-5.4-orange.svg?style=flat
253258
[swift-url]: https://swift.org
254259

@@ -257,9 +262,3 @@ This project is released under the MIT license. See [LICENSE](LICENSE) for detai
257262

258263
[gh-actions-badge]: https://github.com/GraphQLSwift/Graphiti/workflows/Tests/badge.svg
259264
[gh-actions-url]: https://github.com/GraphQLSwift/Graphiti/actions?query=workflow%3ATests
260-
261-
[maintainability-badge]: https://api.codeclimate.com/v1/badges/25559824033fc2caa94e/maintainability
262-
[maintainability-url]: https://codeclimate.com/github/GraphQLSwift/Graphiti/maintainability
263-
264-
[coverage-badge]: https://api.codeclimate.com/v1/badges/25559824033fc2caa94e/test_coverage
265-
[coverage-url]: https://codeclimate.com/github/GraphQLSwift/Graphiti/test_coverage

Sources/Graphiti/Federation/Queries.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ func serviceQuery(for sdl: String) -> GraphQLField {
55
type: GraphQLNonNull(serviceType),
66
description: "Return the SDL string for the subschema",
77
resolve: { _, _, _, _ in
8-
let result = Service(sdl: sdl)
9-
return result
8+
Service(sdl: sdl)
109
}
1110
)
1211
}

Sources/Graphiti/Field/Field/Field.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,5 @@ public extension Field where Arguments == NoArguments {
150150
}
151151
}
152152

153-
// We must conform KeyPath to unchecked sendable to allow keypath-based resolvers.
153+
/// We must conform KeyPath to unchecked sendable to allow keypath-based resolvers.
154154
extension KeyPath: @retroactive @unchecked Sendable {}

Sources/Graphiti/SchemaBuilders/PartialSchema.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,24 @@ open class PartialSchema<Resolver: Sendable, Context: Sendable> {
3232
}
3333

3434
/// Definitions of types
35-
open var types: Types { typedef }
35+
open var types: Types {
36+
typedef
37+
}
3638

3739
/// Definitions of query operation fields
38-
open var query: Fields { querydef }
40+
open var query: Fields {
41+
querydef
42+
}
3943

4044
/// Definitions of mutation operation fields
41-
open var mutation: Fields { mutationdef }
45+
open var mutation: Fields {
46+
mutationdef
47+
}
4248

4349
/// Definitions of subscription operation fields
44-
open var subscription: Fields { subscriptiondef }
50+
open var subscription: Fields {
51+
subscriptiondef
52+
}
4553
}
4654

4755
public extension Schema {

Tests/GraphitiTests/PartialSchemaTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ struct PartialSchemaTests {
130130
}
131131

132132
@Test func partialSchema() async throws {
133-
/// Double check if static func works and the types are inferred properly
133+
// Double check if static func works and the types are inferred properly
134134
let schema = try Schema.create(from: [BaseSchema(), SearchSchema()])
135135

136136
struct PartialSchemaTestAPI: API {
@@ -161,7 +161,7 @@ struct PartialSchemaTests {
161161
}
162162

163163
@Test func partialSchemaOutOfOrder() async throws {
164-
/// Double check if ordering of partial schema doesn't matter
164+
// Double check if ordering of partial schema doesn't matter
165165
let schema = try Schema.create(from: [SearchSchema(), BaseSchema()])
166166

167167
struct PartialSchemaTestAPI: API {
@@ -282,7 +282,7 @@ struct PartialSchemaTests {
282282
}
283283
)
284284

285-
/// Double check if ordering of partial schema doesn't matter
285+
// Double check if ordering of partial schema doesn't matter
286286
let schema = try Schema.create(from: [searchSchema, baseSchema])
287287

288288
struct PartialSchemaTestAPI: API {

Tests/GraphitiTests/ScalarTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,4 @@ struct StringCodedCoordinate: Codable {
721721
struct DictCodedCoordinate: Codable {
722722
let latitude: Double
723723
let longitude: Double
724-
725-
init(latitude: Double, longitude: Double) {
726-
self.latitude = latitude
727-
self.longitude = longitude
728-
}
729724
}

Tests/GraphitiTests/SchemaTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import GraphQL
44
import Testing
55

66
struct SchemaTests {
7-
// Tests that circularly dependent objects can be used in schema and resolved correctly
7+
/// Tests that circularly dependent objects can be used in schema and resolved correctly
88
@Test func circularDependencies() async throws {
99
struct A: Codable {
1010
let name: String
@@ -68,7 +68,7 @@ struct SchemaTests {
6868
)
6969
}
7070

71-
// Tests that we can resolve type references for named types
71+
/// Tests that we can resolve type references for named types
7272
@Test func typeReferenceForNamedType() async throws {
7373
struct LocationObject: Codable {
7474
let id: String

Tests/GraphitiTests/StarWarsTests/StarWarsIntrospectionTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
@testable import Graphiti
12
import GraphQL
23
import Testing
34

4-
@testable import Graphiti
5-
65
struct StarWarsIntrospectionTests {
76
private let api = StarWarsAPI()
87

Tests/GraphitiTests/StarWarsTests/StarWarsQueryTests.swift

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -498,47 +498,7 @@ struct StarWarsQueryTests {
498498
}
499499

500500
@Test func nonNullableFieldsQuery() async throws {
501-
struct A {
502-
func nullableA(context _: NoContext, arguments _: NoArguments) -> A? {
503-
return A()
504-
}
505-
506-
func nonNullA(context _: NoContext, arguments _: NoArguments) -> A {
507-
return A()
508-
}
509-
510-
func `throws`(context _: NoContext, arguments _: NoArguments) throws -> String {
511-
struct 🏃: Error, CustomStringConvertible {
512-
let description: String
513-
}
514-
515-
throw 🏃(description: "catch me if you can.")
516-
}
517-
}
518-
519-
struct TestResolver {
520-
func nullableA(context _: NoContext, arguments _: NoArguments) -> A? {
521-
return A()
522-
}
523-
}
524-
525-
struct MyAPI: API {
526-
var resolver: TestResolver = .init()
527-
528-
let schema = try! Schema<TestResolver, NoContext> {
529-
Type(A.self) {
530-
Field("nullableA", at: A.nullableA)
531-
Field("nonNullA", at: A.nonNullA)
532-
Field("throws", at: A.throws)
533-
}
534-
535-
Query {
536-
Field("nullableA", at: TestResolver.nullableA)
537-
}
538-
}
539-
}
540-
let api = MyAPI()
541-
501+
let api = NonNullableFieldsAPI()
542502
let result = try await api.execute(
543503
request: """
544504
query {
@@ -574,6 +534,46 @@ struct StarWarsQueryTests {
574534
)
575535
}
576536

537+
struct NonNullableFieldsAPI: API {
538+
struct A {
539+
func nullableA(context _: NoContext, arguments _: NoArguments) -> A? {
540+
return A()
541+
}
542+
543+
func nonNullA(context _: NoContext, arguments _: NoArguments) -> A {
544+
return A()
545+
}
546+
547+
func `throws`(context _: NoContext, arguments _: NoArguments) throws -> String {
548+
struct 🏃: Error, CustomStringConvertible {
549+
let description: String
550+
}
551+
552+
throw 🏃(description: "catch me if you can.")
553+
}
554+
}
555+
556+
struct TestResolver {
557+
func nullableA(context _: NoContext, arguments _: NoArguments) -> A? {
558+
return A()
559+
}
560+
}
561+
562+
var resolver: TestResolver = .init()
563+
564+
let schema = try! Schema<TestResolver, NoContext> {
565+
Type(A.self) {
566+
Field("nullableA", at: A.nullableA)
567+
Field("nonNullA", at: A.nonNullA)
568+
Field("throws", at: A.throws)
569+
}
570+
571+
Query {
572+
Field("nullableA", at: TestResolver.nullableA)
573+
}
574+
}
575+
}
576+
577577
@Test func searchQuery() async throws {
578578
let result = try await api.execute(
579579
request: """

Tests/GraphitiTests/ValidationRulesTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import GraphQL
44
import Testing
55

66
struct ValidationRulesTests {
7-
// Test registering custom validation rules
7+
/// Test registering custom validation rules
88
@Test func registeringCustomValidationRule() async throws {
99
struct TestResolver {
10-
var helloWorld: String { "Hellow World" }
10+
var helloWorld: String {
11+
"Hellow World"
12+
}
1113
}
1214

1315
let testSchema = try Schema<TestResolver, NoContext> {

0 commit comments

Comments
 (0)