Skip to content

Commit b55312e

Browse files
authored
Fix non-required schema references (#38)
- `.reference(required: false)` now works as expected
1 parent 53179d9 commit b55312e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
The FeatherOpenAPI library makes it easy to define OpenAPI specifications using Swift in a type-safe way.
44

55
[
6-
![Release: 1.0.0-beta.3](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E3-F05138)
6+
![Release: 1.0.0-beta.4](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E4-F05138)
77
](
8-
https://github.com/feather-framework/feather-openapi/releases/tag/1.0.0-beta.3
8+
https://github.com/feather-framework/feather-openapi/releases/tag/1.0.0-beta.4
99
)
1010

1111
## Features
@@ -34,7 +34,7 @@ The FeatherOpenAPI library makes it easy to define OpenAPI specifications using
3434
Use Swift Package Manager; add the dependency to your `Package.swift` file:
3535

3636
```swift
37-
.package(url: "https://github.com/feather-framework/feather-openapi", exact: "1.0.0-beta.3"),
37+
.package(url: "https://github.com/feather-framework/feather-openapi", exact: "1.0.0-beta.4"),
3838
```
3939

4040
Then add `FeatherOpenAPI` to your target dependencies:

Sources/FeatherOpenAPI/Schema/Abstraction/SchemaRepresentable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension SchemaRepresentable {
3030
public func reference(
3131
required: Bool = true
3232
) -> SchemaReference<Self> {
33-
.init(self)
33+
.init(self, required: required)
3434
}
3535

3636
/// Default deprecated flag is `nil`.

Tests/FeatherOpenAPITests/TestObjects.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ struct TodoDetailObject: ObjectSchemaRepresentable {
7373
[
7474
"id": TodoIDField().reference(),
7575
"title": TodoTitleField(),
76-
"isComplete": TodoIsCompleteField(),
77-
// "unsafe": UnsafeSchemaReference("asdf"),
76+
"isComplete": TodoIsCompleteField().reference(required: false),
77+
// "unsafe": UnsafeSchemaReference("asdf"),
7878
]
7979
}
8080

0 commit comments

Comments
 (0)