Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ jobs:
fail-fast: false
matrix:
image:
- swift:5.2-xenial
- swift:5.2-bionic
- swift:5.2-focal
- swift:5.2-centos8
- swift:5.2-amazonlinux2
- swiftlang/swift:nightly-5.3-xenial
- swiftlang/swift:nightly-5.3-bionic
- swift:5.3-xenial
- swift:5.3-bionic
- swift:5.3-focal
- swift:5.3-centos8
- swift:5.3-amazonlinux2
container: ${{ matrix.image }}
steps:
- name: Checkout code
Expand Down
46 changes: 23 additions & 23 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/mattpolzin/Sampleable.git", from: "2.0.0"),
.package(url: "https://github.com/mattpolzin/JSONAPI.git", from: "4.0.0"),
.package(url: "https://github.com/mattpolzin/JSONAPI.git", from: "5.0.0"),
.package(url: "https://github.com/mattpolzin/OpenAPIKit.git", from: "1.4.0"),
.package(url: "https://github.com/mattpolzin/OpenAPIReflection.git", .upToNextMinor(from: "0.3.0")),
.package(url: "https://github.com/typelift/SwiftCheck.git", .upToNextMinor(from: "0.12.0")),
.package(url: "https://github.com/apple/swift-format.git", from: "0.50200.1"),
.package(url: "https://github.com/apple/swift-format.git", from: "0.50300.0"),
.package(name: "NonEmpty", url: "https://github.com/pointfreeco/swift-nonempty.git", .upToNextMinor(from: "0.2.0")),
.package(url: "https://github.com/mattpolzin/JSONAPIViz.git", .upToNextMinor(from: "0.0.5"))
.package(url: "https://github.com/mattpolzin/JSONAPIViz.git", .exact("0.0.6"))
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# JSONAPI+OpenAPI
[![MIT license](http://img.shields.io/badge/license-MIT-lightgrey.svg)](http://opensource.org/licenses/MIT) [![Swift 5.1/5.2](http://img.shields.io/badge/Swift-5.1/5.2-blue.svg)](https://swift.org) [![Build Status](https://app.bitrise.io/app/2ae0b5578e1905b8/status.svg?token=T8UAUN08e1_GnYk1z3P98g&branch=master)](https://app.bitrise.io/app/2ae0b5578e1905b8)
[![MIT license](http://img.shields.io/badge/license-MIT-lightgrey.svg)](http://opensource.org/licenses/MIT) [![Swift 5.3](http://img.shields.io/badge/Swift-5.3-blue.svg)](https://swift.org) [![Build Status](https://app.bitrise.io/app/2ae0b5578e1905b8/status.svg?token=T8UAUN08e1_GnYk1z3P98g&branch=master)](https://app.bitrise.io/app/2ae0b5578e1905b8)

See parent project: https://github.com/mattpolzin/JSONAPI

Expand Down
26 changes: 14 additions & 12 deletions Tests/JSONAPIOpenAPITests/JSONAPIEntityOpenAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,23 +342,25 @@ extension JSONAPIEntityOpenAPITests {
public typealias Attributes = NoAttributes

public struct Relationships: JSONAPI.Relationships, Sampleable {
public let toOne: ToOneRelationship<TestType1, NoMetadata, NoLinks>
public let optionalTooOne: ToOneRelationship<TestType1, NoMetadata, NoLinks>?
public let nullableToOne: ToOneRelationship<TestType1?, NoMetadata, NoLinks>
public let nullableOptionalToOne: ToOneRelationship<TestType1?, NoMetadata, NoLinks>?
public let toOne: ToOneRelationship<TestType1, NoIdMetadata, NoMetadata, NoLinks>
public let optionalTooOne: ToOneRelationship<TestType1, NoIdMetadata, NoMetadata, NoLinks>?
public let nullableToOne: ToOneRelationship<TestType1?, NoIdMetadata, NoMetadata, NoLinks>
public let nullableOptionalToOne: ToOneRelationship<TestType1?, NoIdMetadata, NoMetadata, NoLinks>?

public let toMany: ToManyRelationship<TestType1, NoMetadata, NoLinks>
public let optionalToMany: ToManyRelationship<TestType1, NoMetadata, NoLinks>?
public let toMany: ToManyRelationship<TestType1, NoIdMetadata, NoMetadata, NoLinks>
public let optionalToMany: ToManyRelationship<TestType1, NoIdMetadata, NoMetadata, NoLinks>?
// Note there is no such thing as nullable to-many relationships (Just use
// an empty array)

public static var sample: Relationships {
return Relationships(toOne: .init(id: .init(rawValue: "1")),
optionalTooOne: nil,
nullableToOne: .init(id: nil),
nullableOptionalToOne: nil,
toMany: .init(ids: [.init(rawValue: "1")]),
optionalToMany: nil)
return Relationships(
toOne: .init(id: .init(rawValue: "1")),
optionalTooOne: nil,
nullableToOne: .init(id: nil),
nullableOptionalToOne: nil,
toMany: .init(ids: [.init(rawValue: "1")]),
optionalToMany: nil
)
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions Tests/JSONAPIOpenAPITests/JSONAPIRelationshipsOpenAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import JSONAPIOpenAPI
class JSONAPIRelationshipsOpenAPITests: XCTestCase {

func test_ToOne() {
let node = ToOneRelationship<TestEntity1, NoMetadata, NoLinks>.openAPISchema
let node = ToOneRelationship<TestEntity1, NoIdMetadata, NoMetadata, NoLinks>.openAPISchema

XCTAssertTrue(node.required)
XCTAssertEqual(node.jsonTypeFormat, .object(.generic))
Expand Down Expand Up @@ -48,7 +48,7 @@ class JSONAPIRelationshipsOpenAPITests: XCTestCase {
}

func test_OptionalToOne() {
let node = ToOneRelationship<TestEntity1, NoMetadata, NoLinks>?.openAPISchema
let node = ToOneRelationship<TestEntity1, NoIdMetadata, NoMetadata, NoLinks>?.openAPISchema

XCTAssertFalse(node.required)
XCTAssertEqual(node.jsonTypeFormat, .object(.generic))
Expand Down Expand Up @@ -81,7 +81,7 @@ class JSONAPIRelationshipsOpenAPITests: XCTestCase {
}

func test_NullableToOne() {
let node = ToOneRelationship<TestEntity1?, NoMetadata, NoLinks>.openAPISchema
let node = ToOneRelationship<TestEntity1?, NoIdMetadata, NoMetadata, NoLinks>.openAPISchema

XCTAssertTrue(node.required)
XCTAssertEqual(node.jsonTypeFormat, .object(.generic))
Expand Down Expand Up @@ -114,7 +114,7 @@ class JSONAPIRelationshipsOpenAPITests: XCTestCase {
}

func test_OptionalNullableToOne() {
let node = ToOneRelationship<TestEntity1?, NoMetadata, NoLinks>?.openAPISchema
let node = ToOneRelationship<TestEntity1?, NoIdMetadata, NoMetadata, NoLinks>?.openAPISchema

XCTAssertFalse(node.required)
XCTAssertEqual(node.jsonTypeFormat, .object(.generic))
Expand Down Expand Up @@ -147,7 +147,7 @@ class JSONAPIRelationshipsOpenAPITests: XCTestCase {
}

func test_ToMany() {
let node = ToManyRelationship<TestEntity1, NoMetadata, NoLinks>.openAPISchema
let node = ToManyRelationship<TestEntity1, NoIdMetadata, NoMetadata, NoLinks>.openAPISchema

XCTAssertTrue(node.required)
XCTAssertEqual(node.jsonTypeFormat, .object(.generic))
Expand Down Expand Up @@ -190,7 +190,7 @@ class JSONAPIRelationshipsOpenAPITests: XCTestCase {
}

func test_OptionalToMany() {
let node = ToManyRelationship<TestEntity1, NoMetadata, NoLinks>?.openAPISchema
let node = ToManyRelationship<TestEntity1, NoIdMetadata, NoMetadata, NoLinks>?.openAPISchema

XCTAssertFalse(node.required)
XCTAssertEqual(node.jsonTypeFormat, .object(.generic))
Expand Down Expand Up @@ -250,7 +250,7 @@ extension JSONAPIRelationshipsOpenAPITests {
typealias Attributes = NoAttributes

struct Relationships: JSONAPI.Relationships {
let other: ToOneRelationship<TestEntity1, NoMetadata, NoLinks>
let other: ToOneRelationship<TestEntity1, NoIdMetadata, NoMetadata, NoLinks>
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ enum TestPersonDescription: JSONAPI.ResourceObjectDescription {
}

struct Relationships: JSONAPI.Relationships {
let friends: ToManyRelationship<TestPerson, NoMetadata, NoLinks>
let friends: ToManyRelationship<TestPerson, NoIdMetadata, NoMetadata, NoLinks>
}
}

Expand Down