Skip to content

Commit

Permalink
Generate OFREP OpenAPI client
Browse files Browse the repository at this point in the history
  • Loading branch information
slashmo committed Dec 13, 2024
1 parent 2410034 commit 96f2747
Show file tree
Hide file tree
Showing 8 changed files with 2,421 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.gitignore
.licenseignore
.unacceptablelanguageignore
.swiftformatignore
.swift-format
.editorconfig
*.md
Expand All @@ -9,3 +10,5 @@
Package.swift
.gitmodules
protocol/
Makefile
*/Generated/**
1 change: 1 addition & 0 deletions .swiftformatignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sources/OFREP/Generated
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Code generation
# -----------------------------------------------------------------------------
OPENAPI_SPEC = protocol/service/openapi.yaml
OPENAPI_GEN_SWIFT = .build/debug/swift-openapi-generator
GEN_SWIFT_ROOT = Sources/OFREP/Generated
GEN_SWIFTS = $(GEN_SWIFT_ROOT)/Types.swift,$(GEN_SWIFT_ROOT)/Client.swift

$(OPENAPI_GEN_SWIFT):
swift build --product swift-openapi-generator

$(GEN_SWIFTS): $(OPENAPI_SPEC) $(OPENAPI_GEN_SWIFT)
@mkdir -pv $(GEN_SWIFT_ROOT)
$(OPENAPI_GEN_SWIFT) generate \
$(OPENAPI_SPEC) \
--mode types \
--mode client \
--output-directory $(GEN_SWIFT_ROOT)

.PHONY: generate
generate: $(GEN_SWIFTS)
7 changes: 5 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ let package = Package(
.library(name: "OFREP", targets: ["OFREP"])
],
dependencies: [
.package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main")
.package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main"),
.package(url: "https://github.com/apple/swift-openapi-generator.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime.git", from: "1.0.0"),
],
targets: [
.target(
name: "OFREP",
dependencies: [
.product(name: "OpenFeature", package: "swift-open-feature")
.product(name: "OpenFeature", package: "swift-open-feature"),
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
]
),
.testTarget(
Expand Down
445 changes: 445 additions & 0 deletions Sources/OFREP/Generated/Client.swift

Large diffs are not rendered by default.

1,947 changes: 1,947 additions & 0 deletions Sources/OFREP/Generated/Types.swift

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Sources/OFREP/openapi.yaml

This file was deleted.

File renamed without changes.

0 comments on commit 96f2747

Please sign in to comment.