@team-supercharge/oasg 16.7.1-temp-feat-swift-openapi-generator-e02341ef → 16.7.1-temp-feat-swift-openapi-generator-f4a258e6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config.schema.yml CHANGED
@@ -20,6 +20,7 @@ properties:
20
20
  - $ref: '#/targets/Stubby'
21
21
  - $ref: '#/targets/Android'
22
22
  - $ref: '#/targets/ios'
23
+ - $ref: '#/targets/SwiftOpenAPIGenerator'
23
24
  - $ref: '#/targets/Python'
24
25
  - $ref: '#/targets/PythonLegacy'
25
26
  - $ref: '#/targets/PythonFastApi'
@@ -318,13 +319,13 @@ targets:
318
319
  - properties:
319
320
  type:
320
321
  pattern: "^swift-openapi-generator$"
321
- packageName:
322
+ projectName:
322
323
  type: string
323
- repositoryUrl:
324
+ repository:
324
325
  type: string
325
326
  required:
326
- - packageName
327
- - repositoryUrl
327
+ - projectName
328
+ - repository
328
329
 
329
330
  Python:
330
331
  allOf:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-supercharge/oasg",
3
- "version": "16.7.1-temp-feat-swift-openapi-generator-e02341ef",
3
+ "version": "16.7.1-temp-feat-swift-openapi-generator-f4a258e6",
4
4
  "description": "Node-based tool to lint OpenAPI documents and generate clients, servers and documentation from them",
5
5
  "author": "Supercharge",
6
6
  "license": "MIT",
@@ -8,6 +8,10 @@ let package = Package(
8
8
  .library(
9
9
  name: "__PROJECT_NAME__",
10
10
  targets: ["__PROJECT_NAME__"]
11
+ ),
12
+ .library(
13
+ name: "__PROJECT_NAME__Server",
14
+ targets: ["__PROJECT_NAME__Server"]
11
15
  )
12
16
  ],
13
17
  dependencies: [
@@ -21,6 +25,12 @@ let package = Package(
21
25
  .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
22
26
  .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
23
27
  ]
24
- )
28
+ ),
29
+ .target(
30
+ name: "__PROJECT_NAME__Server",
31
+ dependencies: [
32
+ .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
33
+ ]
34
+ ),
25
35
  ]
26
36
  )
@@ -1,47 +1,24 @@
1
1
  #/bin/bash
2
2
 
3
- CURRENT_WORKING_DIR=$(pwd)
4
-
5
3
  source $(dirname "$0")/../common.sh
6
4
 
7
5
  # Clear the output directory
8
6
  rm -rf out/$targetId
9
7
  mkdir -p out/$targetId
10
8
 
11
- # Variables
12
- SWIFT_OPENAPI_GENERATOR_GIT_URL=https://github.com/apple/swift-openapi-generator
13
- SWIFT_OPENAPI_GENERATOR_GIT_TAG=1.7.2
14
- SWIFT_OPENAPI_GENERATOR_CLONE_DIR=swift-openapi-generator/$SWIFT_OPENAPI_GENERATOR_GIT_TAG
15
- SWIFT_OPENAPI_GENERATOR_BIN="$SWIFT_OPENAPI_GENERATOR_CLONE_DIR/.build/release/swift-openapi-generator"
16
- OPENAPI_GENERATOR_CONFIG_PATH=openapi-generator-config.yaml
17
-
18
- # Clear OpenAPI generator directory
19
- rm -rf "$SWIFT_OPENAPI_GENERATOR_CLONE_DIR"
20
- mkdir -p "$SWIFT_OPENAPI_GENERATOR_CLONE_DIR"
21
-
22
- # Checkout the swift-openapi-generator repo
23
- git \
24
- -c advice.detachedHead=false \
25
- clone \
26
- --branch "$SWIFT_OPENAPI_GENERATOR_GIT_TAG" \
27
- --depth 1 \
28
- "$SWIFT_OPENAPI_GENERATOR_GIT_URL" \
29
- "$SWIFT_OPENAPI_GENERATOR_CLONE_DIR"
30
-
31
- # Build the swift-openapi-generator
32
- swift \
33
- build \
34
- --package-path "$SWIFT_OPENAPI_GENERATOR_CLONE_DIR" \
35
- --configuration release \
36
- --product swift-openapi-generator
37
-
38
- # Generate the swift client
39
- "$SWIFT_OPENAPI_GENERATOR_BIN" \
9
+ # Generate swift code from OpenAPI spec
10
+ swift-openapi-generator \
40
11
  generate \
41
- --config "$OPENAPI_GENERATOR_CONFIG_PATH" \
12
+ --config "openapi-generator-config-client.yaml" \
42
13
  --output-directory "out/$targetId/Sources/$projectName" \
43
14
  "$openApiFile"
44
15
 
16
+ swift-openapi-generator \
17
+ generate \
18
+ --config "openapi-generator-config-server.yaml" \
19
+ --output-directory "out/$targetId/Sources/${projectName}Server" \
20
+ "$openApiFile"
21
+
45
22
  # Copy Package.swift file
46
23
  cp Package.swift out/$targetId
47
24
  sed -i '' "s/__PROJECT_NAME__/$projectName/" out/$targetId/Package.swift
@@ -0,0 +1,5 @@
1
+ generate:
2
+ - types
3
+ - server
4
+ accessModifier: public
5
+ namingStrategy: idiomatic