Skip to content

Commit 53179d9

Browse files
authored
Fix tag duplication issue (#37)
- fix tag duplication - test tag deduplication at document level - prep work for next release in README.md
1 parent 7774225 commit 53179d9

27 files changed

Lines changed: 94 additions & 10 deletions

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.2](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E2-F05138)
6+
![Release: 1.0.0-beta.3](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E3-F05138)
77
](
8-
https://github.com/feather-framework/feather-openapi/releases/tag/1.0.0-beta.2
8+
https://github.com/feather-framework/feather-openapi/releases/tag/1.0.0-beta.3
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.2"),
37+
.package(url: "https://github.com/feather-framework/feather-openapi", exact: "1.0.0-beta.3"),
3838
```
3939

4040
Then add `FeatherOpenAPI` to your target dependencies:

Sources/FeatherOpenAPI/Document/DocumentRepresentable.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ extension DocumentRepresentable {
3838

3939
/// Collects all tags referenced by the document.
4040
public var referencedTags: [OpenAPITagRepresentable] {
41-
paths.values.map { $0.referencedTags }.flatMap { $0 }
41+
var seen = Set<String>()
42+
return paths.values
43+
.map { $0.referencedTags }
44+
.flatMap { $0 }
45+
.filter { tag in
46+
let name = tag.openAPITag().name
47+
if seen.contains(name) {
48+
return false
49+
}
50+
seen.insert(name)
51+
return true
52+
}
4253
}
4354

4455
/// Collects all security requirements referenced by the document.
File renamed without changes.

Tests/FeatherOpenAPITests/Example/ExampleDocument.swift renamed to Tests/FeatherOpenAPITests/Example/Components/ExampleDocument.swift

File renamed without changes.

Tests/FeatherOpenAPITests/Example/ExampleDuplicatedItem.swift renamed to Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItem.swift

File renamed without changes.

Tests/FeatherOpenAPITests/Example/ExampleDuplicatedItemDocument.swift renamed to Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItemDocument.swift

File renamed without changes.

Tests/FeatherOpenAPITests/Example/ExampleDuplicatedItemModel+Schemas.swift renamed to Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItemModel+Schemas.swift

File renamed without changes.

Tests/FeatherOpenAPITests/Example/ExampleDuplicatedItemModel.swift renamed to Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItemModel.swift

File renamed without changes.

Tests/FeatherOpenAPITests/Example/ExampleMissingParentItem.swift renamed to Tests/FeatherOpenAPITests/Example/Components/ExampleMissingParentItem.swift

File renamed without changes.

Tests/FeatherOpenAPITests/Example/ExampleMissingParentItemDocument.swift renamed to Tests/FeatherOpenAPITests/Example/Components/ExampleMissingParentItemDocument.swift

File renamed without changes.

0 commit comments

Comments
 (0)