@team-supercharge/oasg 13.0.0-test-export-01191261.0 → 13.1.0-kmp-8a9ad834.0

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.
Files changed (43) hide show
  1. package/README.md +47 -12
  2. package/bin/oasg +15 -17
  3. package/config.schema.yml +29 -3
  4. package/package.json +2 -2
  5. package/targets/android/generate.sh +2 -2
  6. package/targets/android/generator-config.json +6 -1
  7. package/targets/android/templates/build.gradle.mustache +54 -21
  8. package/targets/android/templates/libraries/jvm-retrofit2/api.mustache +2 -10
  9. package/targets/android/templates/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache +354 -0
  10. package/targets/common.sh +0 -8
  11. package/targets/feign/generator-config.json +4 -3
  12. package/targets/feign/templates/beanValidation.mustache +2 -7
  13. package/targets/feign/templates/formParams.mustache +2 -1
  14. package/targets/feign/templates/libraries/spring-cloud/clientConfiguration.mustache +118 -0
  15. package/targets/feign/templates/libraries/spring-cloud/pom-sb3.mustache +16 -16
  16. package/targets/feign/templates/libraries/spring-cloud/pom.mustache +16 -16
  17. package/targets/feign-kotlin/generator-config.json +3 -3
  18. package/targets/feign-kotlin/templates/libraries/spring-cloud/pom-sb3.mustache +2 -1
  19. package/targets/flutter/generate.sh +0 -5
  20. package/targets/kmp/generate.sh +21 -0
  21. package/targets/kmp/generator-config.json +12 -0
  22. package/targets/kmp/publish.sh +11 -0
  23. package/targets/kmp/templates/build.gradle.kts.mustache +121 -0
  24. package/targets/kmp/templates/libraries/multiplatform/api.mustache +136 -0
  25. package/targets/nestjs/generate.sh +1 -0
  26. package/targets/nestjs/generator-config.json +5 -0
  27. package/targets/nestjs/templates/api.service.mustache +1 -1
  28. package/targets/nestjs/templates/reorder-operations.js +1 -1
  29. package/targets/nestjs/templates/rewrite-path-parameters.js +2 -2
  30. package/targets/react/generator-config.json +14 -0
  31. package/targets/spring/generator-config.json +4 -4
  32. package/targets/spring/templates/libraries/spring-boot/pom-sb3.mustache +247 -0
  33. package/targets/spring/templates/libraries/spring-boot/pom.mustache +257 -0
  34. package/targets/spring-kotlin/generator-config.json +3 -3
  35. package/targets/spring-kotlin/templates/libraries/spring-boot/pom-sb3.mustache +0 -1
  36. package/targets/spring-kotlin/templates/libraries/spring-boot/pom.mustache +0 -1
  37. package/targets/.env +0 -3
  38. package/targets/feign-kotlin/templates/apiInterface.mustache +0 -108
  39. package/targets/feign-kotlin/templates/dataClassReqVar.mustache +0 -5
  40. package/targets/react-native/generator-config.json +0 -7
  41. package/targets/spring-kotlin/templates/dataClassReqVar.mustache +0 -5
  42. /package/targets/{react-native → react}/generate.sh +0 -0
  43. /package/targets/{react-native → react}/publish.sh +0 -0
@@ -16,11 +16,6 @@ java -jar $binary generate \
16
16
  -ppubRepository=$repository \
17
17
  -ppubVersion=$version $generatorCustomArgs
18
18
 
19
- echo '--------------------------------'
20
- echo $DART_SDK
21
- echo $TEST_VARIABLE
22
- echo '--------------------------------'
23
-
24
19
  cd out/$targetId
25
20
  dart pub get
26
21
  dart run build_runner build
@@ -0,0 +1,21 @@
1
+ #/bin/bash
2
+
3
+ source $(dirname "$0")/../common.sh
4
+
5
+ rm -rf out/$targetId
6
+ mkdir -p out/$targetId
7
+
8
+ if [ -z "$formatterCustomArgs" ]
9
+ then
10
+ formatterCustomArgs="--disabled_rules=no-wildcard-imports,max-line-length,enum-entry-name-case"
11
+ fi
12
+
13
+ java -jar $binary generate \
14
+ -g $generatorId \
15
+ -i $openApiFile \
16
+ -t $templateDir \
17
+ -o out/$targetId \
18
+ -c $(dirname "$0")/generator-config.json \
19
+ -p "artifactId=${artifactId},groupId=${groupId},packageName=${packageName},artifactVersion=${version}" $generatorCustomArgs
20
+
21
+ $formatterBinary -F "out/$targetId/src/**/*.kt" $formatterCustomArgs
@@ -0,0 +1,12 @@
1
+ {
2
+ "library": "multiplatform",
3
+ "enumPropertyNaming": "original",
4
+ "dateLibrary": "kotlinx-datetime",
5
+ "useCoroutines": true,
6
+ "omitGradleWrapper": false,
7
+ "inlineSchemaOptions": {
8
+ "ARRAY_ITEM_SUFFIX": "",
9
+ "MAP_ITEM_SUFFIX": "",
10
+ "SKIP_SCHEMA_REUSE": "true"
11
+ }
12
+ }
@@ -0,0 +1,11 @@
1
+ #/bin/bash
2
+
3
+ source $(dirname "$0")/../common.sh
4
+
5
+ cd out/$targetId
6
+
7
+ chmod a+x gradlew
8
+
9
+ ./gradlew clean publish -PrepoUrl=$repository
10
+
11
+ cd ../..
@@ -0,0 +1,121 @@
1
+ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
2
+
3
+ plugins {
4
+ kotlin("multiplatform"){{^omitGradlePluginVersions}} version "1.9.20" // kotlin_version{{/omitGradlePluginVersions}}
5
+ kotlin("plugin.serialization"){{^omitGradlePluginVersions}} version "1.9.20" // kotlin_version{{/omitGradlePluginVersions}}
6
+ id("maven-publish") // OASg added for publication
7
+ }
8
+
9
+ group = "{{groupId}}"
10
+ version = "{{artifactVersion}}"
11
+
12
+ val kotlin_version = "1.9.20"
13
+ val coroutines_version = "1.7.3"
14
+ val serialization_version = "1.6.1"
15
+ val ktor_version = "2.3.6"
16
+
17
+ repositories {
18
+ mavenCentral()
19
+ }
20
+
21
+ kotlin {
22
+ jvm()
23
+ iosX64()
24
+ iosArm64()
25
+ iosSimulatorArm64()
26
+ js {
27
+ browser()
28
+ nodejs()
29
+ }
30
+
31
+ sourceSets {
32
+ commonMain {
33
+ dependencies {
34
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
35
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serialization_version")
36
+
37
+ api("io.ktor:ktor-client-core:$ktor_version")
38
+ api("io.ktor:ktor-client-serialization:$ktor_version")
39
+ api("io.ktor:ktor-client-content-negotiation:$ktor_version")
40
+ api("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
41
+
42
+ {{#kotlinx-datetime}}
43
+ api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
44
+ {{/kotlinx-datetime}}
45
+ }
46
+ }
47
+
48
+ commonTest {
49
+ dependencies {
50
+ implementation(kotlin("test"))
51
+ implementation("io.ktor:ktor-client-mock:$ktor_version")
52
+ }
53
+ }
54
+
55
+ jvmMain {
56
+ dependencies {
57
+ implementation(kotlin("stdlib-jdk7"))
58
+ implementation("io.ktor:ktor-client-cio-jvm:$ktor_version")
59
+ }
60
+ }
61
+
62
+ jvmTest {
63
+ dependencies {
64
+ implementation(kotlin("test-junit"))
65
+ }
66
+ }
67
+
68
+ iosMain {
69
+ dependencies {
70
+ api("io.ktor:ktor-client-ios:$ktor_version")
71
+ }
72
+ }
73
+
74
+ jsMain {
75
+ dependencies {
76
+ api("io.ktor:ktor-client-js:$ktor_version")
77
+ }
78
+ }
79
+
80
+ all {
81
+ languageSettings.apply {
82
+ optIn("kotlin.Experimental")
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ tasks {
89
+ register("iosTest") {
90
+ val device = project.findProperty("device")?.toString() ?: "iPhone 8"
91
+ dependsOn("linkDebugTestIosX64")
92
+ group = JavaBasePlugin.VERIFICATION_GROUP
93
+ description = "Execute unit tests on ${device} simulator"
94
+ doLast {
95
+ val binary = kotlin.targets.getByName<KotlinNativeTarget>("iosX64").binaries.getTest("DEBUG")
96
+ exec {
97
+ commandLine("xcrun", "simctl", "spawn", device, binary.outputFile)
98
+ }
99
+ }
100
+ }
101
+ register("test") {
102
+ dependsOn("allTests")
103
+ }
104
+ }
105
+
106
+ // OASg added for publication
107
+ publishing {
108
+ repositories {
109
+ maven {
110
+ name = "Gitlab"
111
+ url = uri(project.property("repoUrl")!!)
112
+ credentials(HttpHeaderCredentials::class) {
113
+ name = "Job-Token"
114
+ value = System.getenv("CI_JOB_TOKEN")
115
+ }
116
+ authentication {
117
+ create<HttpHeaderAuthentication>("header")
118
+ }
119
+ }
120
+ }
121
+ }
@@ -0,0 +1,136 @@
1
+ {{>licenseInfo}}
2
+ package {{apiPackage}}
3
+
4
+ {{#imports}}import {{import}}
5
+ {{/imports}}
6
+
7
+ import {{packageName}}.infrastructure.*
8
+ import io.ktor.client.HttpClient
9
+ import io.ktor.client.HttpClientConfig
10
+ import io.ktor.client.call.body
11
+ import io.ktor.client.request.forms.formData
12
+ import io.ktor.client.engine.HttpClientEngine
13
+ import kotlinx.serialization.json.Json
14
+ import io.ktor.http.ParametersBuilder
15
+ import kotlinx.serialization.*
16
+ import kotlinx.serialization.descriptors.*
17
+ import kotlinx.serialization.encoding.*
18
+
19
+ {{#operations}}
20
+ {{#nonPublicApi}}internal {{/nonPublicApi}}open class {{classname}} : ApiClient {
21
+
22
+ constructor(
23
+ baseUrl: String = ApiClient.BASE_URL,
24
+ httpClientEngine: HttpClientEngine? = null,
25
+ httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
26
+ jsonSerializer: Json = ApiClient.JSON_DEFAULT
27
+ ) : super(baseUrl = baseUrl, httpClientEngine = httpClientEngine, httpClientConfig = httpClientConfig, jsonBlock = jsonSerializer)
28
+
29
+ constructor(
30
+ baseUrl: String,
31
+ httpClient: HttpClient
32
+ ): super(baseUrl = baseUrl, httpClient = httpClient)
33
+
34
+ {{#operation}}
35
+ {{#allParams}}
36
+ {{#isEnum}}
37
+
38
+ /**
39
+ * enum for parameter {{paramName}}
40
+ */
41
+ @Serializable
42
+ {{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{enumName}}{{operationIdCamelCase}}(val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}) {
43
+ {{^enumUnknownDefaultCase}}
44
+ {{#allowableValues}}{{#enumVars}}
45
+ @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}})
46
+ {{&name}}({{{value}}}){{^-last}},{{/-last}}
47
+ {{/enumVars}}{{/allowableValues}}
48
+ {{/enumUnknownDefaultCase}}
49
+ {{#enumUnknownDefaultCase}}
50
+ {{#allowableValues}}{{#enumVars}}{{^-last}}
51
+ @SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}})
52
+ {{&name}}({{{value}}}),
53
+ {{/-last}}{{/enumVars}}{{/allowableValues}}
54
+ {{/enumUnknownDefaultCase}}
55
+ }
56
+
57
+ {{/isEnum}}
58
+ {{/allParams}}
59
+ /**
60
+ * {{summary}}
61
+ * {{notes}}
62
+ {{#allParams}} * @param {{{paramName}}} {{description}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}{{/required}}
63
+ {{/allParams}} * @return {{{returnType}}}{{^returnType}}void{{/returnType}}
64
+ */
65
+ {{#returnType}}
66
+ @Suppress("UNCHECKED_CAST")
67
+ {{/returnType}}
68
+ open suspend fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{/required}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): {{{returnType}}}{{^returnType}}Unit{{/returnType}} {
69
+
70
+ val localVariableAuthNames = listOf<String>({{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}})
71
+
72
+ val localVariableBody = {{#hasBodyParam}}{{#bodyParam}}{{#isArray}}{{operationIdCamelCase}}Request({{{paramName}}}{{^isList}}.asList(){{/isList}}){{/isArray}}{{^isArray}}{{#isMap}}{{operationIdCamelCase}}Request({{{paramName}}}){{/isMap}}{{^isMap}}{{{paramName}}}{{/isMap}}{{/isArray}}{{/bodyParam}}{{/hasBodyParam}}
73
+ {{^hasBodyParam}}
74
+ {{#hasFormParams}}
75
+ {{#isMultipart}}
76
+ formData {
77
+ {{#formParams}}
78
+ {{#isArray}}
79
+ {{{paramName}}}?.onEach {
80
+ append("{{{baseName}}}[]", it)
81
+ }
82
+ {{/isArray}}
83
+ {{^isArray}}
84
+ {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}) }
85
+ {{/isArray}}
86
+ {{/formParams}}
87
+ }
88
+ {{/isMultipart}}
89
+ {{^isMultipart}}
90
+ ParametersBuilder().also {
91
+ {{#formParams}}
92
+ {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.toString()) }
93
+ {{/formParams}}
94
+ }.build()
95
+ {{/isMultipart}}
96
+ {{/hasFormParams}}
97
+ {{^hasFormParams}}
98
+ io.ktor.client.utils.EmptyContent
99
+ {{/hasFormParams}}
100
+ {{/hasBodyParam}}
101
+
102
+ val localVariableQuery = mutableMapOf<String, List<String>>(){{#queryParams}}
103
+ {{{paramName}}}?.apply { localVariableQuery["{{baseName}}"] = {{#isContainer}}toMultiValue(this, "{{collectionFormat}}"){{/isContainer}}{{^isContainer}}listOf("${{{paramName}}}"){{/isContainer}} }{{/queryParams}}
104
+ val localVariableHeaders = mutableMapOf<String, String>(){{#headerParams}}
105
+ {{{paramName}}}?.apply { localVariableHeaders["{{baseName}}"] = {{#isContainer}}this.joinToString(separator = collectionDelimiter("{{collectionFormat}}")){{/isContainer}}{{^isContainer}}this.toString(){{/isContainer}} }{{/headerParams}}
106
+
107
+ val localVariableConfig = RequestConfig<kotlin.Any?>(
108
+ RequestMethod.{{httpMethod}},
109
+ "{{path}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}"${{{paramName}}}"{{/isContainer}}){{/pathParams}},
110
+ query = localVariableQuery,
111
+ headers = localVariableHeaders,
112
+ requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}},
113
+ )
114
+
115
+ return {{#hasBodyParam}}jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}multipartFormRequest{{/isMultipart}}{{^isMultipart}}urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}request{{/hasFormParams}}{{/hasBodyParam}}(
116
+ localVariableConfig,
117
+ localVariableBody,
118
+ localVariableAuthNames
119
+ ).body()
120
+ }
121
+
122
+ {{#hasBodyParam}}
123
+ {{#bodyParam}}
124
+ {{#isArray}}{{>serial_wrapper_request_list}}{{/isArray}}{{#isMap}}{{>serial_wrapper_request_map}}{{/isMap}}
125
+ {{/bodyParam}}
126
+ {{/hasBodyParam}}
127
+ {{#isArray}}
128
+ {{>serial_wrapper_response_list}}
129
+ {{/isArray}}
130
+ {{#isMap}}
131
+ {{>serial_wrapper_response_map}}
132
+ {{/isMap}}
133
+
134
+ {{/operation}}
135
+ }
136
+ {{/operations}}
@@ -34,6 +34,7 @@ rm reorder-operations.js
34
34
  node unescape-patterns.js
35
35
  rm unescape-patterns.js
36
36
 
37
+ # rewrite path parameters
37
38
  node rewrite-path-parameters.js
38
39
  rm rewrite-path-parameters.js
39
40
 
@@ -36,5 +36,10 @@
36
36
  },
37
37
  "typeMappings": {
38
38
  "Blob": "Express.Multer.File"
39
+ },
40
+ "inlineSchemaOptions": {
41
+ "ARRAY_ITEM_SUFFIX": "",
42
+ "MAP_ITEM_SUFFIX": "",
43
+ "SKIP_SCHEMA_REUSE": "true"
39
44
  }
40
45
  }
@@ -47,7 +47,7 @@ export abstract class {{classname}} {
47
47
  //// @{{httpMethod}}('{{path}}'){{#isMultipart}}
48
48
  @UseInterceptors(FileInterceptor({{#formParams}}{{#isFile}}'{{paramName}}'{{/isFile}}{{/formParams}})){{/isMultipart}}
49
49
  @HttpCode({{#responses.0}}{{code}}{{/responses.0}})
50
- private _{{nickname}}(@Request() req{{#allParams}}{{^isBodyParam}}, {{#isQueryParam}}@Query({{/isQueryParam}}{{#isPathParam}}@Param({{/isPathParam}}{{#isHeaderParam}}@Headers({{/isHeaderParam}}{{#isFormParam}}{{^isFile}}@Body({{/isFile}}{{#isFile}}@UploadedFile({{/isFile}}{{/isFormParam}}'{{paramName}}'{{#required}}, RequiredPipe{{/required}}{{#isArray}}, new ApiParseArrayPipe({ optional: true{{#items}}{{#isNumeric}}, items: Number{{/isNumeric}}{{#isBoolean}}, items: Boolean{{/isBoolean}}{{/items}} }){{/isArray}}{{#isNumber}}, OptionalParseFloatPipe{{/isNumber}}{{#isFloat}}, OptionalParseFloatPipe{{/isFloat}}{{#isDouble}}, OptionalParseFloatPipe{{/isDouble}}{{#isInteger}}, OptionalParseIntPipe{{/isInteger}}{{#isLong}}, OptionalParseIntPipe{{/isLong}}{{#isBoolean}}, OptionalParseBoolPipe{{/isBoolean}}{{#allowableValues}}{{^enumVars.empty}}, new OptionalParseEnumPipe({{{dataType}}}){{/enumVars.empty}}{{/allowableValues}}) {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{/isBodyParam}}{{/allParams}}{{#bodyParam}}, @Body(new ApiValidationPipe({ whitelist: true, forbidNonWhitelisted: true })) requestBody{{^required}}?{{/required}}: {{{dataType}}}{{/bodyParam}}): Promise<{{#returnType}}{{#isResponseFile}}StreamableFile{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
50
+ private _{{nickname}}(@Request() req{{#allParams}}{{^isBodyParam}}, {{#isQueryParam}}@Query({{/isQueryParam}}{{#isPathParam}}@Param({{/isPathParam}}{{#isHeaderParam}}@Headers({{/isHeaderParam}}{{#isFormParam}}{{^isFile}}@Body({{/isFile}}{{#isFile}}@UploadedFile({{/isFile}}{{/isFormParam}}'{{paramName}}'{{#required}}{{#isHeaderParam}}{{/isHeaderParam}}{{^isHeaderParam}}, RequiredPipe{{/isHeaderParam}}{{/required}}{{#isArray}}, new ApiParseArrayPipe({ optional: true{{#items}}{{#isNumeric}}, items: Number{{/isNumeric}}{{#isBoolean}}, items: Boolean{{/isBoolean}}{{/items}} }){{/isArray}}{{#isNumber}}, OptionalParseFloatPipe{{/isNumber}}{{#isFloat}}, OptionalParseFloatPipe{{/isFloat}}{{#isDouble}}, OptionalParseFloatPipe{{/isDouble}}{{#isInteger}}, OptionalParseIntPipe{{/isInteger}}{{#isLong}}, OptionalParseIntPipe{{/isLong}}{{#isBoolean}}, OptionalParseBoolPipe{{/isBoolean}}{{#allowableValues}}{{^enumVars.empty}}, new OptionalParseEnumPipe({{{dataType}}}){{/enumVars.empty}}{{/allowableValues}}) {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{/isBodyParam}}{{/allParams}}{{#bodyParam}}, @Body(new ApiValidationPipe({ whitelist: true, forbidNonWhitelisted: true })) requestBody{{^required}}?{{/required}}: {{{dataType}}}{{/bodyParam}}): Promise<{{#returnType}}{{#isResponseFile}}StreamableFile{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
51
51
  return this.{{nickname}}({{#allParams.0}}{ params: { {{#allParams}}{{^isBodyParam}}{{^-first}}, {{/-first}}{{paramName}}{{/isBodyParam}}{{/allParams}} }{{#bodyParam}}, body: requestBody{{/bodyParam}} }, {{/allParams.0}}req);
52
52
  }
53
53
 
@@ -3,7 +3,7 @@ const fs = require('fs');
3
3
  const apiFolder = './api';
4
4
  const apiFileSuffix = '.api.ts';
5
5
  const separator = '// ||||||||||\n';
6
- const pathParamKey = 'encodeURIComponent';
6
+ const pathParamKey = 'this.configuration.encodeParam';
7
7
 
8
8
  const apiFiles = fs.readdirSync(apiFolder).filter(fileName => fileName.endsWith(apiFileSuffix));
9
9
  apiFiles.forEach(apiFile => reorderOperations(apiFile));
@@ -11,8 +11,8 @@ function rewritePathParameters(fileName) {
11
11
  const file = `${apiFolder}/${fileName}`;
12
12
  const contents = fs.readFileSync(file, 'utf-8');
13
13
 
14
- var result = contents.replace(/\${encodeURIComponent\(String\(/g, ':');
15
- result = result.replace(/\)\)\}/g, '');
14
+ var result = contents.replace(/\${this\.configuration\.encodeParam\({name:\s&quot;/g, ':');
15
+ result = result.replace(/&quot;.*}\)}/g, '');
16
16
 
17
17
  var options = { flag : 'w', encoding: 'utf8' };
18
18
  fs.writeFileSync(file, result, options);
@@ -0,0 +1,14 @@
1
+ {
2
+ "typescriptThreePlus": "true",
3
+ "supportsES6": "true",
4
+ "modelPropertyNaming": "original",
5
+ "withInterfaces": "true",
6
+ "fileNaming": "camelCase",
7
+ "stringEnums": "true",
8
+ "enumPropertyNaming": "UPPERCASE",
9
+ "inlineSchemaOptions": {
10
+ "ARRAY_ITEM_SUFFIX": "",
11
+ "MAP_ITEM_SUFFIX": "",
12
+ "SKIP_SCHEMA_REUSE": "true"
13
+ }
14
+ }
@@ -13,14 +13,14 @@
13
13
  "annotationLibrary": "none",
14
14
  "useSpringBoot3": true,
15
15
  "typeMappings": {
16
- "OffsetDateTime": "Instant"
16
+ "OffsetDateTime": "java.time.Instant"
17
17
  },
18
18
  "importMappings": {
19
19
  "java.time.OffsetDateTime": "java.time.Instant"
20
20
  },
21
- "inlineSchemaNameDefaults": {
22
- "arrayItemSuffix": "",
23
- "mapItemSuffix": "",
21
+ "inlineSchemaOptions": {
22
+ "ARRAY_ITEM_SUFFIX": "",
23
+ "MAP_ITEM_SUFFIX": "",
24
24
  "SKIP_SCHEMA_REUSE": "true"
25
25
  }
26
26
  }
@@ -0,0 +1,247 @@
1
+ {{! attach sources }}
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+ <groupId>{{groupId}}</groupId>
5
+ <artifactId>{{artifactId}}</artifactId>
6
+ <packaging>jar</packaging>
7
+ <name>{{artifactId}}</name>
8
+ <version>{{artifactVersion}}</version>
9
+ <properties>
10
+ <java.version>17</java.version>
11
+ <maven.compiler.source>${java.version}</maven.compiler.source>
12
+ <maven.compiler.target>${java.version}</maven.compiler.target>
13
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14
+ {{#springDocDocumentationProvider}}
15
+ <springdoc.version>2.0.2</springdoc.version>
16
+ {{/springDocDocumentationProvider}}
17
+ {{^springDocDocumentationProvider}}
18
+ {{#swagger2AnnotationLibrary}}
19
+ <swagger-annotations.version>}2.2.7</swagger-annotations.version>
20
+ {{/swagger2AnnotationLibrary}}
21
+ {{/springDocDocumentationProvider}}
22
+ {{#useSwaggerUI}}
23
+ <swagger-ui.version>4.15.5</swagger-ui.version>
24
+ {{/useSwaggerUI}}
25
+ {{#virtualService}}
26
+ <virtualan.version>2.5.2</virtualan.version>
27
+ {{/virtualService}}
28
+ </properties>
29
+ {{#parentOverridden}}
30
+ <parent>
31
+ <groupId>{{{parentGroupId}}}</groupId>
32
+ <artifactId>{{{parentArtifactId}}}</artifactId>
33
+ <version>{{{parentVersion}}}</version>
34
+ </parent>
35
+ {{/parentOverridden}}
36
+ {{^parentOverridden}}
37
+ <parent>
38
+ <groupId>org.springframework.boot</groupId>
39
+ <artifactId>spring-boot-starter-parent</artifactId>
40
+ <version>3.0.0</version>
41
+ <relativePath/> <!-- lookup parent from repository -->
42
+ </parent>
43
+ {{/parentOverridden}}
44
+
45
+ <repositories>
46
+ <repository>
47
+ <id>repository.spring.milestone</id>
48
+ <name>Spring Milestone Repository</name>
49
+ <url>https://repo.spring.io/milestone</url>
50
+ </repository>
51
+ </repositories>
52
+ <pluginRepositories>
53
+ <pluginRepository>
54
+ <id>spring-milestones</id>
55
+ <url>https://repo.spring.io/milestone</url>
56
+ </pluginRepository>
57
+ </pluginRepositories>
58
+
59
+ <build>
60
+ <sourceDirectory>src/main/java</sourceDirectory>
61
+ {{#interfaceOnly}}
62
+ <plugins>
63
+ <plugin>
64
+ <groupId>org.apache.maven.plugins</groupId>
65
+ <artifactId>maven-source-plugin</artifactId>
66
+ <executions>
67
+ <execution>
68
+ <id>attach-sources</id>
69
+ <goals>
70
+ <goal>jar</goal>
71
+ </goals>
72
+ </execution>
73
+ </executions>
74
+ </plugin>
75
+ </plugins>
76
+ {{/interfaceOnly}}
77
+ {{^interfaceOnly}}
78
+ <plugins>
79
+ <plugin>
80
+ <groupId>org.springframework.boot</groupId>
81
+ <artifactId>spring-boot-maven-plugin</artifactId>
82
+ {{#classifier}}
83
+ <configuration>
84
+ <classifier>{{{classifier}}}</classifier>
85
+ </configuration>
86
+ {{/classifier}}
87
+ </plugin>
88
+ {{#apiFirst}}
89
+ <plugin>
90
+ <groupId>org.openapitools</groupId>
91
+ <artifactId>openapi-generator-maven-plugin</artifactId>
92
+ <version>{{{generatorVersion}}}</version>
93
+ <executions>
94
+ <execution>
95
+ <goals>
96
+ <goal>generate</goal>
97
+ </goals>
98
+ <configuration>
99
+ <inputSpec>src/main/resources/openapi.yaml</inputSpec>
100
+ <generatorName>spring</generatorName>
101
+ <apiPackage>{{{apiPackage}}}</apiPackage>
102
+ <modelPackage>{{{modelPackage}}}</modelPackage>
103
+ <generateSupportingFiles>false</generateSupportingFiles>
104
+ {{#modelNamePrefix}}
105
+ <modelNamePrefix>{{{.}}}</modelNamePrefix>
106
+ {{/modelNamePrefix}}
107
+ {{#modelNameSuffix}}
108
+ <modelNameSuffix>{{{.}}}</modelNameSuffix>
109
+ {{/modelNameSuffix}}
110
+ <configOptions>
111
+ {{#configOptions}}
112
+ <{{left}}>{{right}}</{{left}}>
113
+ {{/configOptions}}
114
+ </configOptions>
115
+ </configuration>
116
+ </execution>
117
+ </executions>
118
+ </plugin>
119
+ {{/apiFirst}}
120
+ </plugins>
121
+ {{/interfaceOnly}}
122
+ </build>
123
+ <dependencies>
124
+ <dependency>
125
+ <groupId>org.springframework.boot</groupId>
126
+ <artifactId>spring-boot-starter-web{{#reactive}}flux{{/reactive}}</artifactId>
127
+ </dependency>
128
+ <dependency>
129
+ <groupId>org.springframework.data</groupId>
130
+ <artifactId>spring-data-commons</artifactId>
131
+ </dependency>
132
+ {{#springDocDocumentationProvider}}
133
+ <!--SpringDoc dependencies -->
134
+ {{#useSwaggerUI}}
135
+ <dependency>
136
+ <groupId>org.springdoc</groupId>
137
+ <artifactId>springdoc-openapi-starter-{{#reactive}}webflux{{/reactive}}{{^reactive}}webmvc{{/reactive}}-ui</artifactId>
138
+ <version>${springdoc.version}</version>
139
+ </dependency>
140
+ {{/useSwaggerUI}}
141
+ {{^useSwaggerUI}}
142
+ <dependency>
143
+ <groupId>org.springdoc</groupId>
144
+ <artifactId>springdoc-openapi-starter-{{#reactive}}webflux{{/reactive}}{{^reactive}}webmvc{{/reactive}}-api</artifactId>
145
+ <version>${springdoc.version}</version>
146
+ </dependency>
147
+ {{/useSwaggerUI}}
148
+ {{/springDocDocumentationProvider}}
149
+ {{#useSwaggerUI}}
150
+ {{^springDocDocumentationProvider}}
151
+ <dependency>
152
+ <groupId>org.webjars</groupId>
153
+ <artifactId>swagger-ui</artifactId>
154
+ <version>${swagger-ui.version}</version>
155
+ </dependency>
156
+ <dependency>
157
+ <groupId>org.webjars</groupId>
158
+ <artifactId>webjars-locator-core</artifactId>
159
+ </dependency>
160
+ {{/springDocDocumentationProvider}}
161
+ {{/useSwaggerUI}}
162
+ {{^springDocDocumentationProvider}}
163
+ {{#swagger2AnnotationLibrary}}
164
+ <dependency>
165
+ <groupId>io.swagger.core.v3</groupId>
166
+ <artifactId>swagger-annotations</artifactId>
167
+ <version>${swagger-annotations.version}</version>
168
+ </dependency>
169
+ {{/swagger2AnnotationLibrary}}
170
+ {{/springDocDocumentationProvider}}
171
+ <!-- @Nullable annotation -->
172
+ <dependency>
173
+ <groupId>com.google.code.findbugs</groupId>
174
+ <artifactId>jsr305</artifactId>
175
+ <version>3.0.2</version>
176
+ </dependency>
177
+ <dependency>
178
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
179
+ <artifactId>jackson-dataformat-yaml</artifactId>
180
+ </dependency>
181
+ {{#withXml}}
182
+ <!-- XML processing: Jackson -->
183
+ <dependency>
184
+ <groupId>jakarta.xml.bind</groupId>
185
+ <artifactId>jakarta.xml.bind-api</artifactId>
186
+ </dependency>
187
+ <dependency>
188
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
189
+ <artifactId>jackson-dataformat-xml</artifactId>
190
+ </dependency>
191
+ {{/withXml}}
192
+ <dependency>
193
+ <groupId>com.fasterxml.jackson.datatype</groupId>
194
+ <artifactId>jackson-datatype-jsr310</artifactId>
195
+ </dependency>
196
+ {{#joda}}
197
+ <dependency>
198
+ <groupId>com.fasterxml.jackson.datatype</groupId>
199
+ <artifactId>jackson-datatype-joda</artifactId>
200
+ </dependency>
201
+ {{/joda}}
202
+ {{#openApiNullable}}
203
+ <dependency>
204
+ <groupId>org.openapitools</groupId>
205
+ <artifactId>jackson-databind-nullable</artifactId>
206
+ <version>0.2.6</version>
207
+ </dependency>
208
+ {{/openApiNullable}}
209
+ {{#useBeanValidation}}
210
+ <!-- Bean Validation API support -->
211
+ <dependency>
212
+ <groupId>org.springframework.boot</groupId>
213
+ <artifactId>spring-boot-starter-validation</artifactId>
214
+ </dependency>
215
+ {{/useBeanValidation}}
216
+ {{#virtualService}}
217
+ <!-- START Virtual Service API support -->
218
+ <dependency>
219
+ <groupId>io.virtualan</groupId>
220
+ <artifactId>virtualan-plugin</artifactId>
221
+ <version>${virtualan.version}</version>
222
+ </dependency>
223
+ <!-- HyperSQL DB -->
224
+ <dependency>
225
+ <groupId>org.hsqldb</groupId>
226
+ <artifactId>hsqldb</artifactId>
227
+ </dependency>
228
+ <!-- END Virtual Service API support -->
229
+ {{/virtualService}}
230
+ {{#hateoas}}
231
+ <!-- Spring HATEOAS -->
232
+ <dependency>
233
+ <groupId>org.springframework.boot</groupId>
234
+ <artifactId>spring-boot-starter-hateoas</artifactId>
235
+ </dependency>
236
+ {{/hateoas}}
237
+ <dependency>
238
+ <groupId>com.fasterxml.jackson.core</groupId>
239
+ <artifactId>jackson-databind</artifactId>
240
+ </dependency>
241
+ <dependency>
242
+ <groupId>org.springframework.boot</groupId>
243
+ <artifactId>spring-boot-starter-test</artifactId>
244
+ <scope>test</scope>
245
+ </dependency>
246
+ </dependencies>
247
+ </project>