Skip to content

Commit bac44ad

Browse files
committed
Generate OFREP OpenAPI client
1 parent 7b3e2ae commit bac44ad

File tree

8 files changed

+2421
-3
lines changed

8 files changed

+2421
-3
lines changed

.licenseignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.gitignore
22
.licenseignore
33
.unacceptablelanguageignore
4+
.swiftformatignore
45
.swift-format
56
.editorconfig
67
*.md
@@ -9,3 +10,5 @@
910
Package.swift
1011
.gitmodules
1112
protocol/
13+
Makefile
14+
*/Generated/**

.swiftformatignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sources/OFREP/Generated

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Code generation
2+
# -----------------------------------------------------------------------------
3+
OPENAPI_SPEC = protocol/service/openapi.yaml
4+
OPENAPI_GEN_SWIFT = .build/debug/swift-openapi-generator
5+
GEN_SWIFT_ROOT = Sources/OFREP/Generated
6+
GEN_SWIFTS = $(GEN_SWIFT_ROOT)/Types.swift,$(GEN_SWIFT_ROOT)/Client.swift
7+
8+
$(OPENAPI_GEN_SWIFT):
9+
swift build --product swift-openapi-generator
10+
11+
$(GEN_SWIFTS): $(OPENAPI_SPEC) $(OPENAPI_GEN_SWIFT)
12+
@mkdir -pv $(GEN_SWIFT_ROOT)
13+
$(OPENAPI_GEN_SWIFT) generate \
14+
$(OPENAPI_SPEC) \
15+
--mode types \
16+
--mode client \
17+
--output-directory $(GEN_SWIFT_ROOT)
18+
19+
.PHONY: generate
20+
generate: $(GEN_SWIFTS)

Package.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ let package = Package(
1313
.library(name: "OFREP", targets: ["OFREP"])
1414
],
1515
dependencies: [
16-
.package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main")
16+
.package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main"),
17+
.package(url: "https://github.com/apple/swift-openapi-generator.git", from: "1.0.0"),
18+
.package(url: "https://github.com/apple/swift-openapi-runtime.git", from: "1.0.0"),
1719
],
1820
targets: [
1921
.target(
2022
name: "OFREP",
2123
dependencies: [
22-
.product(name: "OpenFeature", package: "swift-open-feature")
24+
.product(name: "OpenFeature", package: "swift-open-feature"),
25+
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
2326
]
2427
),
2528
.testTarget(

Sources/OFREP/Generated/Client.swift

Lines changed: 445 additions & 0 deletions
Large diffs are not rendered by default.

Sources/OFREP/Generated/Types.swift

Lines changed: 1947 additions & 0 deletions
Large diffs are not rendered by default.

Sources/OFREP/openapi.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)