@team-supercharge/oasg 16.4.0-feature-aspdotnetcore-generator-72786d96.0 → 16.4.1-temp-oasg-template-387f8911
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/README.md +23 -22
- package/bin/oasg +1 -1
- package/config.schema.yml +23 -17
- package/package.json +1 -1
- package/targets/nestjs/templates/package.mustache +3 -3
- package/targets/plain-java/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
- package/targets/plain-java/.mvn/wrapper/maven-wrapper.jar +0 -0
- package/targets/plain-java/.mvn/wrapper/maven-wrapper.properties +2 -0
- package/targets/plain-java/generate.sh +20 -0
- package/targets/plain-java/generator-config.json +20 -0
- package/targets/plain-java/mvnw +310 -0
- package/targets/plain-java/publish.sh +30 -0
- package/targets/plain-java/settings.xml +16 -0
- package/targets/react/templates/package.mustache +1 -3
- package/targets/react/templates/tsconfig.mustache +1 -7
- package/targets/dotnet-webapi/generate.sh +0 -15
- package/targets/dotnet-webapi/generator-config.json +0 -17
- package/targets/dotnet-webapi/publish.sh +0 -21
- package/targets/dotnet-webapi/templates/model.mustache +0 -198
package/README.md
CHANGED
@@ -8,6 +8,7 @@ Design APIs in OpenAPI 3.0 format, lint them, and generate client/server package
|
|
8
8
|
* [Create `.config.json`](#create-config.json)
|
9
9
|
* [Configure Linter](#configure-linter)
|
10
10
|
* [Use with Docker](#use-with-docker)
|
11
|
+
* [Use with GitLab CI](#use-with-gitlab-ci)
|
11
12
|
* [Version Overview](#version-overview)
|
12
13
|
* [Usage](#usage)
|
13
14
|
* [Linter Rules](#linter-rules)
|
@@ -101,6 +102,26 @@ swaggerlint:
|
|
101
102
|
|
102
103
|
> If no other dependency is needed for the API project being built, there is no need to run any `npm install` or `npm ci` commands before invoking `oasg`
|
103
104
|
|
105
|
+
## Use with GitLab CI
|
106
|
+
|
107
|
+
Built on the [Docker](#use-with-docker) setup, a set of predefined templates are readily available for GitLab CI.
|
108
|
+
|
109
|
+
When your project is hosted on gitlab.com __OASg__ should always be included in your projects `.gitlab-ci.yml` by explicitly specifying a version, like this:
|
110
|
+
|
111
|
+
```yaml
|
112
|
+
include:
|
113
|
+
- project: team-supercharge/oasg
|
114
|
+
file: gitlab-ci-templates.yml
|
115
|
+
ref: <version tag>
|
116
|
+
```
|
117
|
+
|
118
|
+
when your project is hosted on a self-managed GitLab instance use the following snippet:
|
119
|
+
|
120
|
+
```yaml
|
121
|
+
include:
|
122
|
+
- https://gitlab.com/team-supercharge/oasg/raw/<version-tag>/gitlab-ci-templates.yml
|
123
|
+
```
|
124
|
+
|
104
125
|
---
|
105
126
|
|
106
127
|
# Version Overview
|
@@ -118,12 +139,13 @@ The table below gives an overview of the changes (breaking, non-breaking, bug fi
|
|
118
139
|
| `dotnet` |➖ |➖ |🆕 |
|
119
140
|
| `feign` |✨ |➖ |➖ |➖ |➖ |➖ |✨ |💥 |💥 |➖ |➖ |🐛 |🐛 |🆕 |
|
120
141
|
| `feign-kotlin` |✨ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
142
|
+
| `plain-java` |🆕 |
|
121
143
|
| `flutter` |➖ |➖ |➖ |🆕 |
|
122
144
|
| `ios` |➖ |➖ |➖ |💥 |🐛 |➖ |➖ |➖ |✨ |➖ |💥 |➖ |➖ |✨ |🆕 |
|
123
145
|
| `kmp` |➖ |➖ |🆕 |
|
124
146
|
| `python` |🆕 |
|
125
147
|
| `python-legacy` |💥 |➖ |🐛 |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
126
|
-
| `react`
|
148
|
+
| `react` |🐛 |🐛 |➖ |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
127
149
|
| `typescript-axios` |🆕 |
|
128
150
|
| `typescript-fetch` |🆕 |
|
129
151
|
| **Server Targets** | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|
@@ -1006,27 +1028,6 @@ Validations from OpenAPI spec:
|
|
1006
1028
|
| packageName | Name of the generated package | Y | - |
|
1007
1029
|
| generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
|
1008
1030
|
|
1009
|
-
#### `dotnet-webapi`
|
1010
|
-
|
1011
|
-
```json
|
1012
|
-
{
|
1013
|
-
"id": "dotnet-webapi",
|
1014
|
-
"type": "dotnet-webapi",
|
1015
|
-
"source": "source-merged",
|
1016
|
-
"sourceUrl": "https://api.nuget.org/v3/index.json",
|
1017
|
-
"apiKey": "apiKey",
|
1018
|
-
"packageName": "packageName",
|
1019
|
-
"generatorCustomArgs": "--global-property=supportingFiles,modelDocs --additional-properties=nullableReferenceTypes=false"
|
1020
|
-
}
|
1021
|
-
```
|
1022
|
-
|
1023
|
-
| Parameter | Description | Required | Default |
|
1024
|
-
| ------------------- | ------------------------------------------------------------------------------ | -------- | ------- |
|
1025
|
-
| sourceUrl | Url to where the package will be published | Y | - |
|
1026
|
-
| packageName | Name of the generated package | Y | - |
|
1027
|
-
| apiKey | Api key of nuget source (If not specified, provide the CI_JOB_TOKEN) | N | - |
|
1028
|
-
| generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
|
1029
|
-
|
1030
1031
|
#### `postman`
|
1031
1032
|
|
1032
1033
|
```json
|
package/bin/oasg
CHANGED
@@ -39,6 +39,7 @@ const DEFAULT_GENERATOR_MAPPING = {
|
|
39
39
|
"angular": { version: '7.11.0', generator: 'typescript-angular' },
|
40
40
|
"feign": { version: '7.11.0', generator: 'spring' },
|
41
41
|
"feign-kotlin": { version: '7.11.0', generator: 'kotlin-spring' },
|
42
|
+
"plain-java": { version: '7.11.0', generator: 'java' },
|
42
43
|
"flutter": { version: '7.0.1', generator: 'dart-dio' },
|
43
44
|
"ios": { version: '7.0.1', generator: 'swift5' },
|
44
45
|
"kmp": { version: '7.8.0', generator: 'kotlin' },
|
@@ -54,7 +55,6 @@ const DEFAULT_GENERATOR_MAPPING = {
|
|
54
55
|
"python-fastapi": { version: '7.8.0', generator: 'python-fastapi' },
|
55
56
|
"python-fastapi-raw-request": { version: '7.0.1', generator: 'python-fastapi' },
|
56
57
|
"dotnet": { version: '7.8.0', generator: 'csharp-functions' },
|
57
|
-
"dotnet-webapi": { version: '7.11.0', generator: 'aspnetcore' },
|
58
58
|
// misc targets
|
59
59
|
"contract-testing": { version: '4.3.1', generator: 'typescript-node' },
|
60
60
|
"openapi": { version: undefined, generator: undefined },
|
package/config.schema.yml
CHANGED
@@ -12,6 +12,7 @@ properties:
|
|
12
12
|
oneOf:
|
13
13
|
- $ref: '#/targets/Angular'
|
14
14
|
- $ref: '#/targets/React'
|
15
|
+
- $ref: '#/targets/PlainJava'
|
15
16
|
- $ref: '#/targets/Feign'
|
16
17
|
- $ref: '#/targets/FeignKotlin'
|
17
18
|
- $ref: '#/targets/Spring'
|
@@ -29,7 +30,6 @@ properties:
|
|
29
30
|
- $ref: '#/targets/Flutter'
|
30
31
|
- $ref: '#/targets/Kmp'
|
31
32
|
- $ref: '#/targets/Dotnet'
|
32
|
-
- $ref: '#/targets/DotnetWebApi'
|
33
33
|
- $ref: '#/targets/Postman'
|
34
34
|
- $ref: '#/targets/TypeScriptAxios'
|
35
35
|
- $ref: '#/targets/TypeScriptFetch'
|
@@ -166,6 +166,28 @@ targets:
|
|
166
166
|
- basePackage
|
167
167
|
- mavenRepoUrl
|
168
168
|
|
169
|
+
PlainJava:
|
170
|
+
allOf:
|
171
|
+
- $ref: '#/targets/Base'
|
172
|
+
- properties:
|
173
|
+
type:
|
174
|
+
pattern: "^plain-java$"
|
175
|
+
artifactId:
|
176
|
+
type: string
|
177
|
+
groupId:
|
178
|
+
type: string
|
179
|
+
basePackage:
|
180
|
+
type: string
|
181
|
+
mavenRepoUrl:
|
182
|
+
type: string
|
183
|
+
overrideSettingsXml:
|
184
|
+
type: string
|
185
|
+
required:
|
186
|
+
- artifactId
|
187
|
+
- groupId
|
188
|
+
- basePackage
|
189
|
+
- mavenRepoUrl
|
190
|
+
|
169
191
|
FeignKotlin:
|
170
192
|
allOf:
|
171
193
|
- $ref: '#/targets/Base'
|
@@ -414,22 +436,6 @@ targets:
|
|
414
436
|
- apiKey
|
415
437
|
- packageName
|
416
438
|
|
417
|
-
DotnetWebApi:
|
418
|
-
allOf:
|
419
|
-
- $ref: '#/targets/Base'
|
420
|
-
- properties:
|
421
|
-
type:
|
422
|
-
pattern: '^dotnet-webapi$'
|
423
|
-
sourceUrl:
|
424
|
-
type: string
|
425
|
-
apiKey:
|
426
|
-
type: string
|
427
|
-
packageName:
|
428
|
-
type: string
|
429
|
-
required:
|
430
|
-
- sourceUrl
|
431
|
-
- packageName
|
432
|
-
|
433
439
|
Kmp:
|
434
440
|
allOf:
|
435
441
|
- $ref: '#/targets/Base'
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@team-supercharge/oasg",
|
3
|
-
"version": "16.4.
|
3
|
+
"version": "16.4.1-temp-oasg-template-387f8911",
|
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",
|
@@ -13,9 +13,9 @@
|
|
13
13
|
},
|
14
14
|
"main": "dist/index.js",
|
15
15
|
"peerDependencies": {
|
16
|
-
"@nestjs/common": "
|
17
|
-
"@nestjs/core": "
|
18
|
-
"@nestjs/platform-express": "
|
16
|
+
"@nestjs/common": ">=10.0.0",
|
17
|
+
"@nestjs/core": ">=10.0.0",
|
18
|
+
"@nestjs/platform-express": ">=10.0.0",
|
19
19
|
"class-transformer": "^0.5.1",
|
20
20
|
"class-validator": "^0.14.0",
|
21
21
|
"reflect-metadata": "0.2.2",
|
@@ -0,0 +1,117 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2007-present the original author or authors.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import java.net.*;
|
17
|
+
import java.io.*;
|
18
|
+
import java.nio.channels.*;
|
19
|
+
import java.util.Properties;
|
20
|
+
|
21
|
+
public class MavenWrapperDownloader {
|
22
|
+
|
23
|
+
private static final String WRAPPER_VERSION = "0.5.6";
|
24
|
+
/**
|
25
|
+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
26
|
+
*/
|
27
|
+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
28
|
+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
32
|
+
* use instead of the default one.
|
33
|
+
*/
|
34
|
+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
35
|
+
".mvn/wrapper/maven-wrapper.properties";
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Path where the maven-wrapper.jar will be saved to.
|
39
|
+
*/
|
40
|
+
private static final String MAVEN_WRAPPER_JAR_PATH =
|
41
|
+
".mvn/wrapper/maven-wrapper.jar";
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Name of the property which should be used to override the default download url for the wrapper.
|
45
|
+
*/
|
46
|
+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
47
|
+
|
48
|
+
public static void main(String args[]) {
|
49
|
+
System.out.println("- Downloader started");
|
50
|
+
File baseDirectory = new File(args[0]);
|
51
|
+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
52
|
+
|
53
|
+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
54
|
+
// wrapperUrl parameter.
|
55
|
+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
56
|
+
String url = DEFAULT_DOWNLOAD_URL;
|
57
|
+
if(mavenWrapperPropertyFile.exists()) {
|
58
|
+
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
59
|
+
try {
|
60
|
+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
61
|
+
Properties mavenWrapperProperties = new Properties();
|
62
|
+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
63
|
+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
64
|
+
} catch (IOException e) {
|
65
|
+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
66
|
+
} finally {
|
67
|
+
try {
|
68
|
+
if(mavenWrapperPropertyFileInputStream != null) {
|
69
|
+
mavenWrapperPropertyFileInputStream.close();
|
70
|
+
}
|
71
|
+
} catch (IOException e) {
|
72
|
+
// Ignore ...
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
System.out.println("- Downloading from: " + url);
|
77
|
+
|
78
|
+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
79
|
+
if(!outputFile.getParentFile().exists()) {
|
80
|
+
if(!outputFile.getParentFile().mkdirs()) {
|
81
|
+
System.out.println(
|
82
|
+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
83
|
+
}
|
84
|
+
}
|
85
|
+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
86
|
+
try {
|
87
|
+
downloadFileFromURL(url, outputFile);
|
88
|
+
System.out.println("Done");
|
89
|
+
System.exit(0);
|
90
|
+
} catch (Throwable e) {
|
91
|
+
System.out.println("- Error downloading");
|
92
|
+
e.printStackTrace();
|
93
|
+
System.exit(1);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
98
|
+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
99
|
+
String username = System.getenv("MVNW_USERNAME");
|
100
|
+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
101
|
+
Authenticator.setDefault(new Authenticator() {
|
102
|
+
@Override
|
103
|
+
protected PasswordAuthentication getPasswordAuthentication() {
|
104
|
+
return new PasswordAuthentication(username, password);
|
105
|
+
}
|
106
|
+
});
|
107
|
+
}
|
108
|
+
URL website = new URL(urlString);
|
109
|
+
ReadableByteChannel rbc;
|
110
|
+
rbc = Channels.newChannel(website.openStream());
|
111
|
+
FileOutputStream fos = new FileOutputStream(destination);
|
112
|
+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
113
|
+
fos.close();
|
114
|
+
rbc.close();
|
115
|
+
}
|
116
|
+
|
117
|
+
}
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#/bin/bash
|
2
|
+
|
3
|
+
source $(dirname "$0")/../common.sh
|
4
|
+
|
5
|
+
rm -rf out/$targetId
|
6
|
+
mkdir -p out/$targetId
|
7
|
+
|
8
|
+
java -jar $binary generate \
|
9
|
+
-g $generatorId \
|
10
|
+
-i $openApiFile \
|
11
|
+
-t $templateDir \
|
12
|
+
-o out/$targetId \
|
13
|
+
-c $(dirname "$0")/generator-config.json \
|
14
|
+
-p "artifactId=${artifactId},groupId=${groupId},basePackage=${basePackage},apiPackage=${basePackage}.api,modelPackage=${basePackage}.model,artifactVersion=${version}" $generatorCustomArgs
|
15
|
+
|
16
|
+
cd out/$targetId
|
17
|
+
cp $(dirname "$0")/mvnw .
|
18
|
+
cp -r $(dirname "$0")/.mvn .
|
19
|
+
./mvnw package
|
20
|
+
cd ../..
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"library": "native",
|
3
|
+
"openApiNullable": false,
|
4
|
+
"useRuntimeException": true,
|
5
|
+
"annotationLibrary": "none",
|
6
|
+
"documentationProvider": "none",
|
7
|
+
"typeMappings": {
|
8
|
+
"DateTime": "java.time.Instant",
|
9
|
+
"OffsetDateTime": "java.time.Instant"
|
10
|
+
},
|
11
|
+
"importMappings": {
|
12
|
+
"DateTime": "java.time.Instant",
|
13
|
+
"java.time.OffsetDateTime": "java.time.Instant"
|
14
|
+
},
|
15
|
+
"inlineSchemaOptions": {
|
16
|
+
"ARRAY_ITEM_SUFFIX": "",
|
17
|
+
"MAP_ITEM_SUFFIX": "",
|
18
|
+
"SKIP_SCHEMA_REUSE": "true"
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,310 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# ----------------------------------------------------------------------------
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
5
|
+
# distributed with this work for additional information
|
6
|
+
# regarding copyright ownership. The ASF licenses this file
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance
|
9
|
+
# with the License. You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
14
|
+
# software distributed under the License is distributed on an
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
+
# KIND, either express or implied. See the License for the
|
17
|
+
# specific language governing permissions and limitations
|
18
|
+
# under the License.
|
19
|
+
# ----------------------------------------------------------------------------
|
20
|
+
|
21
|
+
# ----------------------------------------------------------------------------
|
22
|
+
# Maven Start Up Batch script
|
23
|
+
#
|
24
|
+
# Required ENV vars:
|
25
|
+
# ------------------
|
26
|
+
# JAVA_HOME - location of a JDK home dir
|
27
|
+
#
|
28
|
+
# Optional ENV vars
|
29
|
+
# -----------------
|
30
|
+
# M2_HOME - location of maven2's installed home dir
|
31
|
+
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
32
|
+
# e.g. to debug Maven itself, use
|
33
|
+
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
34
|
+
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
35
|
+
# ----------------------------------------------------------------------------
|
36
|
+
|
37
|
+
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
38
|
+
|
39
|
+
if [ -f /etc/mavenrc ] ; then
|
40
|
+
. /etc/mavenrc
|
41
|
+
fi
|
42
|
+
|
43
|
+
if [ -f "$HOME/.mavenrc" ] ; then
|
44
|
+
. "$HOME/.mavenrc"
|
45
|
+
fi
|
46
|
+
|
47
|
+
fi
|
48
|
+
|
49
|
+
# OS specific support. $var _must_ be set to either true or false.
|
50
|
+
cygwin=false;
|
51
|
+
darwin=false;
|
52
|
+
mingw=false
|
53
|
+
case "`uname`" in
|
54
|
+
CYGWIN*) cygwin=true ;;
|
55
|
+
MINGW*) mingw=true;;
|
56
|
+
Darwin*) darwin=true
|
57
|
+
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
58
|
+
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
59
|
+
if [ -z "$JAVA_HOME" ]; then
|
60
|
+
if [ -x "/usr/libexec/java_home" ]; then
|
61
|
+
export JAVA_HOME="`/usr/libexec/java_home`"
|
62
|
+
else
|
63
|
+
export JAVA_HOME="/Library/Java/Home"
|
64
|
+
fi
|
65
|
+
fi
|
66
|
+
;;
|
67
|
+
esac
|
68
|
+
|
69
|
+
if [ -z "$JAVA_HOME" ] ; then
|
70
|
+
if [ -r /etc/gentoo-release ] ; then
|
71
|
+
JAVA_HOME=`java-config --jre-home`
|
72
|
+
fi
|
73
|
+
fi
|
74
|
+
|
75
|
+
if [ -z "$M2_HOME" ] ; then
|
76
|
+
## resolve links - $0 may be a link to maven's home
|
77
|
+
PRG="$0"
|
78
|
+
|
79
|
+
# need this for relative symlinks
|
80
|
+
while [ -h "$PRG" ] ; do
|
81
|
+
ls=`ls -ld "$PRG"`
|
82
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
83
|
+
if expr "$link" : '/.*' > /dev/null; then
|
84
|
+
PRG="$link"
|
85
|
+
else
|
86
|
+
PRG="`dirname "$PRG"`/$link"
|
87
|
+
fi
|
88
|
+
done
|
89
|
+
|
90
|
+
saveddir=`pwd`
|
91
|
+
|
92
|
+
M2_HOME=`dirname "$PRG"`/..
|
93
|
+
|
94
|
+
# make it fully qualified
|
95
|
+
M2_HOME=`cd "$M2_HOME" && pwd`
|
96
|
+
|
97
|
+
cd "$saveddir"
|
98
|
+
# echo Using m2 at $M2_HOME
|
99
|
+
fi
|
100
|
+
|
101
|
+
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
102
|
+
if $cygwin ; then
|
103
|
+
[ -n "$M2_HOME" ] &&
|
104
|
+
M2_HOME=`cygpath --unix "$M2_HOME"`
|
105
|
+
[ -n "$JAVA_HOME" ] &&
|
106
|
+
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
107
|
+
[ -n "$CLASSPATH" ] &&
|
108
|
+
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
109
|
+
fi
|
110
|
+
|
111
|
+
# For Mingw, ensure paths are in UNIX format before anything is touched
|
112
|
+
if $mingw ; then
|
113
|
+
[ -n "$M2_HOME" ] &&
|
114
|
+
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
115
|
+
[ -n "$JAVA_HOME" ] &&
|
116
|
+
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
117
|
+
fi
|
118
|
+
|
119
|
+
if [ -z "$JAVA_HOME" ]; then
|
120
|
+
javaExecutable="`which javac`"
|
121
|
+
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
122
|
+
# readlink(1) is not available as standard on Solaris 10.
|
123
|
+
readLink=`which readlink`
|
124
|
+
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
125
|
+
if $darwin ; then
|
126
|
+
javaHome="`dirname \"$javaExecutable\"`"
|
127
|
+
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
128
|
+
else
|
129
|
+
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
130
|
+
fi
|
131
|
+
javaHome="`dirname \"$javaExecutable\"`"
|
132
|
+
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
133
|
+
JAVA_HOME="$javaHome"
|
134
|
+
export JAVA_HOME
|
135
|
+
fi
|
136
|
+
fi
|
137
|
+
fi
|
138
|
+
|
139
|
+
if [ -z "$JAVACMD" ] ; then
|
140
|
+
if [ -n "$JAVA_HOME" ] ; then
|
141
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
142
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
143
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
144
|
+
else
|
145
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
146
|
+
fi
|
147
|
+
else
|
148
|
+
JAVACMD="`which java`"
|
149
|
+
fi
|
150
|
+
fi
|
151
|
+
|
152
|
+
if [ ! -x "$JAVACMD" ] ; then
|
153
|
+
echo "Error: JAVA_HOME is not defined correctly." >&2
|
154
|
+
echo " We cannot execute $JAVACMD" >&2
|
155
|
+
exit 1
|
156
|
+
fi
|
157
|
+
|
158
|
+
if [ -z "$JAVA_HOME" ] ; then
|
159
|
+
echo "Warning: JAVA_HOME environment variable is not set."
|
160
|
+
fi
|
161
|
+
|
162
|
+
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
163
|
+
|
164
|
+
# traverses directory structure from process work directory to filesystem root
|
165
|
+
# first directory with .mvn subdirectory is considered project base directory
|
166
|
+
find_maven_basedir() {
|
167
|
+
|
168
|
+
if [ -z "$1" ]
|
169
|
+
then
|
170
|
+
echo "Path not specified to find_maven_basedir"
|
171
|
+
return 1
|
172
|
+
fi
|
173
|
+
|
174
|
+
basedir="$1"
|
175
|
+
wdir="$1"
|
176
|
+
while [ "$wdir" != '/' ] ; do
|
177
|
+
if [ -d "$wdir"/.mvn ] ; then
|
178
|
+
basedir=$wdir
|
179
|
+
break
|
180
|
+
fi
|
181
|
+
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
182
|
+
if [ -d "${wdir}" ]; then
|
183
|
+
wdir=`cd "$wdir/.."; pwd`
|
184
|
+
fi
|
185
|
+
# end of workaround
|
186
|
+
done
|
187
|
+
echo "${basedir}"
|
188
|
+
}
|
189
|
+
|
190
|
+
# concatenates all lines of a file
|
191
|
+
concat_lines() {
|
192
|
+
if [ -f "$1" ]; then
|
193
|
+
echo "$(tr -s '\n' ' ' < "$1")"
|
194
|
+
fi
|
195
|
+
}
|
196
|
+
|
197
|
+
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
198
|
+
if [ -z "$BASE_DIR" ]; then
|
199
|
+
exit 1;
|
200
|
+
fi
|
201
|
+
|
202
|
+
##########################################################################################
|
203
|
+
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
204
|
+
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
205
|
+
##########################################################################################
|
206
|
+
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
207
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
208
|
+
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
209
|
+
fi
|
210
|
+
else
|
211
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
212
|
+
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
213
|
+
fi
|
214
|
+
if [ -n "$MVNW_REPOURL" ]; then
|
215
|
+
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
216
|
+
else
|
217
|
+
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
218
|
+
fi
|
219
|
+
while IFS="=" read key value; do
|
220
|
+
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
221
|
+
esac
|
222
|
+
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
223
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
224
|
+
echo "Downloading from: $jarUrl"
|
225
|
+
fi
|
226
|
+
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
227
|
+
if $cygwin; then
|
228
|
+
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
229
|
+
fi
|
230
|
+
|
231
|
+
if command -v wget > /dev/null; then
|
232
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
233
|
+
echo "Found wget ... using wget"
|
234
|
+
fi
|
235
|
+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
236
|
+
wget "$jarUrl" -O "$wrapperJarPath"
|
237
|
+
else
|
238
|
+
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
239
|
+
fi
|
240
|
+
elif command -v curl > /dev/null; then
|
241
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
242
|
+
echo "Found curl ... using curl"
|
243
|
+
fi
|
244
|
+
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
245
|
+
curl -o "$wrapperJarPath" "$jarUrl" -f
|
246
|
+
else
|
247
|
+
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
248
|
+
fi
|
249
|
+
|
250
|
+
else
|
251
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
252
|
+
echo "Falling back to using Java to download"
|
253
|
+
fi
|
254
|
+
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
255
|
+
# For Cygwin, switch paths to Windows format before running javac
|
256
|
+
if $cygwin; then
|
257
|
+
javaClass=`cygpath --path --windows "$javaClass"`
|
258
|
+
fi
|
259
|
+
if [ -e "$javaClass" ]; then
|
260
|
+
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
261
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
262
|
+
echo " - Compiling MavenWrapperDownloader.java ..."
|
263
|
+
fi
|
264
|
+
# Compiling the Java class
|
265
|
+
("$JAVA_HOME/bin/javac" "$javaClass")
|
266
|
+
fi
|
267
|
+
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
268
|
+
# Running the downloader
|
269
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
270
|
+
echo " - Running MavenWrapperDownloader.java ..."
|
271
|
+
fi
|
272
|
+
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
273
|
+
fi
|
274
|
+
fi
|
275
|
+
fi
|
276
|
+
fi
|
277
|
+
##########################################################################################
|
278
|
+
# End of extension
|
279
|
+
##########################################################################################
|
280
|
+
|
281
|
+
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
282
|
+
if [ "$MVNW_VERBOSE" = true ]; then
|
283
|
+
echo $MAVEN_PROJECTBASEDIR
|
284
|
+
fi
|
285
|
+
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
286
|
+
|
287
|
+
# For Cygwin, switch paths to Windows format before running java
|
288
|
+
if $cygwin; then
|
289
|
+
[ -n "$M2_HOME" ] &&
|
290
|
+
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
291
|
+
[ -n "$JAVA_HOME" ] &&
|
292
|
+
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
293
|
+
[ -n "$CLASSPATH" ] &&
|
294
|
+
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
295
|
+
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
296
|
+
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
297
|
+
fi
|
298
|
+
|
299
|
+
# Provide a "standardized" way to retrieve the CLI args that will
|
300
|
+
# work with both Windows and non-Windows executions.
|
301
|
+
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
302
|
+
export MAVEN_CMD_LINE_ARGS
|
303
|
+
|
304
|
+
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
305
|
+
|
306
|
+
exec "$JAVACMD" \
|
307
|
+
$MAVEN_OPTS \
|
308
|
+
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
309
|
+
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
310
|
+
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#/bin/bash
|
2
|
+
|
3
|
+
source $(dirname "$0")/../common.sh
|
4
|
+
|
5
|
+
settingsXml=${overrideSettingsXml:-$(dirname "$0")/settings.xml}
|
6
|
+
cp $settingsXml out/$targetId/settings.xml
|
7
|
+
|
8
|
+
cd out/$targetId
|
9
|
+
|
10
|
+
echo Deploying ${artifactId}-${version}.jar to ${mavenRepoUrl}
|
11
|
+
|
12
|
+
jarName=target/${artifactId}-${version}.jar
|
13
|
+
|
14
|
+
sourcesJarName=target/${artifactId}-${version}-sources.jar
|
15
|
+
attachSources=""
|
16
|
+
if [ -f ${sourcesJarName} ]; then
|
17
|
+
attachSources="-Dsources=${sourcesJarName}"
|
18
|
+
fi
|
19
|
+
|
20
|
+
./mvnw deploy:deploy-file -e -s settings.xml \
|
21
|
+
-Durl=${mavenRepoUrl} \
|
22
|
+
-DrepositoryId=target \
|
23
|
+
-Dfile=${jarName} \
|
24
|
+
-Dpom=pom.xml \
|
25
|
+
-DgroupId=${groupId} \
|
26
|
+
-DartifactId=${artifactId} \
|
27
|
+
-Dversion=${version} \
|
28
|
+
${attachSources}
|
29
|
+
|
30
|
+
cd ../..
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<settings>
|
2
|
+
<servers>
|
3
|
+
<server>
|
4
|
+
<id>target</id>
|
5
|
+
<configuration>
|
6
|
+
<httpHeaders>
|
7
|
+
<property>
|
8
|
+
|
9
|
+
<name>Job-Token</name>
|
10
|
+
<value>${env.CI_JOB_TOKEN}</value>
|
11
|
+
</property>
|
12
|
+
</httpHeaders>
|
13
|
+
</configuration>
|
14
|
+
</server>
|
15
|
+
</servers>
|
16
|
+
</settings>
|
@@ -13,12 +13,10 @@
|
|
13
13
|
{{^packageAsSourceOnlyLibrary}}
|
14
14
|
"main": "./dist/index.js",
|
15
15
|
"typings": "./dist/index.d.ts",
|
16
|
-
{{#supportsES6}}
|
17
16
|
"module": "./dist/esm/index.js",
|
18
17
|
"sideEffects": false,
|
19
|
-
{{/supportsES6}}
|
20
18
|
"scripts": {
|
21
|
-
"build": "tsc
|
19
|
+
"build": "tsc && tsc -p tsconfig.esm.json"{{^sagasAndRecords}},
|
22
20
|
"prepare": "npm run build"{{/sagasAndRecords}}
|
23
21
|
},
|
24
22
|
{{/packageAsSourceOnlyLibrary}}
|
@@ -1,19 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
3
|
"declaration": true,
|
4
|
-
"target": "
|
4
|
+
"target": "es2022",
|
5
5
|
{{#sagasAndRecords}}
|
6
6
|
"strict": true,
|
7
7
|
{{/sagasAndRecords}}
|
8
8
|
"module": "commonjs",
|
9
9
|
"moduleResolution": "node",
|
10
10
|
"outDir": "dist",
|
11
|
-
{{^supportsES6}}
|
12
|
-
"lib": [
|
13
|
-
"es6",
|
14
|
-
"dom"
|
15
|
-
],
|
16
|
-
{{/supportsES6}}
|
17
11
|
"typeRoots": [
|
18
12
|
"node_modules/@types"
|
19
13
|
],
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
source $(dirname "$0")/../common.sh
|
4
|
-
|
5
|
-
rm -rf out/$targetId
|
6
|
-
mkdir -p out/$targetId
|
7
|
-
|
8
|
-
java -jar $binary generate \
|
9
|
-
-g $generatorId \
|
10
|
-
-i $openApiFile \
|
11
|
-
-t $templateDir \
|
12
|
-
-o out/$targetId \
|
13
|
-
-c $(dirname "$0")/generator-config.json \
|
14
|
-
-p "packageVersion=$version,packageName=$packageName" \
|
15
|
-
$generatorCustomArgs
|
@@ -1,17 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"inlineSchemaOptions": {
|
3
|
-
"ARRAY_ITEM_SUFFIX": "",
|
4
|
-
"MAP_ITEM_SUFFIX": "",
|
5
|
-
"SKIP_SCHEMA_REUSE": "true"
|
6
|
-
},
|
7
|
-
"additionalProperties": {
|
8
|
-
"aspnetCoreVersion": "8.0",
|
9
|
-
"operationIsAsync": true,
|
10
|
-
"buildTarget": "library",
|
11
|
-
"generateBody": false,
|
12
|
-
"nullableReferenceTypes": true,
|
13
|
-
"operationResultTask": true,
|
14
|
-
"enumNameSuffix": "",
|
15
|
-
"enumValueSuffix": ""
|
16
|
-
}
|
17
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
source $(dirname "$0")/../common.sh
|
4
|
-
|
5
|
-
cd out/$targetId
|
6
|
-
|
7
|
-
# install dotnet
|
8
|
-
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
|
9
|
-
chmod +x dotnet-install.sh
|
10
|
-
./dotnet-install.sh --channel 8.0 --install-dir "$HOME/.dotnet"
|
11
|
-
export PATH="$HOME/.dotnet:$PATH"
|
12
|
-
|
13
|
-
# pack
|
14
|
-
dotnet restore
|
15
|
-
dotnet build -c Release
|
16
|
-
dotnet pack -c Release -p:Version=$version -p:IsPackable=true
|
17
|
-
|
18
|
-
# publish
|
19
|
-
dotnet nuget push "src/**/bin/Release/*.nupkg" --source $sourceUrl -k ${apiKey:-$CI_JOB_TOKEN}
|
20
|
-
|
21
|
-
cd ../..
|
@@ -1,198 +0,0 @@
|
|
1
|
-
{{>partial_header}}
|
2
|
-
using System;
|
3
|
-
using System.Linq;
|
4
|
-
using System.Text;
|
5
|
-
using System.Collections.Generic;
|
6
|
-
using System.ComponentModel;
|
7
|
-
using System.ComponentModel.DataAnnotations;
|
8
|
-
using System.Runtime.Serialization;
|
9
|
-
{{#useNewtonsoft}}
|
10
|
-
using Newtonsoft.Json;
|
11
|
-
{{/useNewtonsoft}}
|
12
|
-
{{^useNewtonsoft}}
|
13
|
-
using System.Text.Json;
|
14
|
-
{{/useNewtonsoft}}
|
15
|
-
{{#models}}
|
16
|
-
{{#model}}
|
17
|
-
{{#discriminator}}
|
18
|
-
using JsonSubTypes;
|
19
|
-
{{#useSwashbuckle}}
|
20
|
-
using Swashbuckle.AspNetCore.Annotations;
|
21
|
-
{{/useSwashbuckle}}
|
22
|
-
{{/discriminator}}
|
23
|
-
{{/model}}
|
24
|
-
{{/models}}
|
25
|
-
using {{packageName}}.Converters;
|
26
|
-
|
27
|
-
{{#models}}
|
28
|
-
{{#model}}
|
29
|
-
namespace {{modelPackage}}
|
30
|
-
{ {{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}}
|
31
|
-
/// <summary>
|
32
|
-
/// {{description}}
|
33
|
-
/// </summary>
|
34
|
-
[DataContract]
|
35
|
-
{{#discriminator}}
|
36
|
-
{{#useNewtonsoft}}
|
37
|
-
{{#mappedModels.size}}
|
38
|
-
[JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]
|
39
|
-
{{/mappedModels.size}}
|
40
|
-
{{/useNewtonsoft}}
|
41
|
-
{{#useSwashbuckle}}
|
42
|
-
[SwaggerDiscriminator("{{{discriminatorName}}}")]
|
43
|
-
{{/useSwashbuckle}}
|
44
|
-
{{#mappedModels}}
|
45
|
-
[JsonSubtypes.KnownSubType(typeof({{{modelName}}}), "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
|
46
|
-
{{#useSwashbuckle}}
|
47
|
-
[SwaggerSubType(typeof({{{modelName}}}), DiscriminatorValue = "{{^vendorExtensions.x-discriminator-value}}{{{mappingName}}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{.}}}{{/vendorExtensions.x-discriminator-value}}")]
|
48
|
-
{{/useSwashbuckle}}
|
49
|
-
{{/mappedModels}}
|
50
|
-
{{/discriminator}}
|
51
|
-
public {{#modelClassModifier}}{{.}} {{/modelClassModifier}}class {{classname}} {{#parent}}: {{{.}}}{{^pocoModels}}, {{/pocoModels}}{{/parent}}{{^pocoModels}}{{^parent}}: {{/parent}}IEquatable<{{classname}}>{{/pocoModels}}
|
52
|
-
{
|
53
|
-
{{#vars}}
|
54
|
-
{{#items.isEnum}}
|
55
|
-
{{#items}}
|
56
|
-
{{^complexType}}
|
57
|
-
{{>enumClass}}
|
58
|
-
{{/complexType}}
|
59
|
-
{{/items}}
|
60
|
-
{{/items.isEnum}}
|
61
|
-
{{#isEnum}}
|
62
|
-
{{^complexType}}
|
63
|
-
{{>enumClass}}
|
64
|
-
{{/complexType}}
|
65
|
-
{{/isEnum}}
|
66
|
-
/// <summary>
|
67
|
-
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
|
68
|
-
/// </summary>{{#description}}
|
69
|
-
/// <value>{{.}}</value>{{/description}}{{#example}}
|
70
|
-
/* <example>{{.}}</example> */{{/example}}{{#required}}
|
71
|
-
[Required]{{/required}}{{#pattern}}
|
72
|
-
[RegularExpression("{{{.}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}
|
73
|
-
[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}}
|
74
|
-
[MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}}
|
75
|
-
[MaxLength({{.}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}
|
76
|
-
[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}
|
77
|
-
[DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}true{{/vendorExtensions.x-is-value-type}}{{^vendorExtensions.x-is-value-type}}false{{/vendorExtensions.x-is-value-type}}{{/isNullable}})]
|
78
|
-
{{#isEnum}}
|
79
|
-
public {{{datatypeWithEnum}}}{{#isNullable}}{{^required}}?{{/required}}{{/isNullable}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}
|
80
|
-
{{/isEnum}}
|
81
|
-
{{^isEnum}}
|
82
|
-
public {{{dataType}}}{{#nullableReferenceTypes}}{{^isContainer}}{{^required}}{{^isNullable}}?{{/isNullable}}{{/required}}{{/isContainer}}{{/nullableReferenceTypes}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}
|
83
|
-
{{/isEnum}}
|
84
|
-
{{^-last}}
|
85
|
-
|
86
|
-
{{/-last}}
|
87
|
-
{{/vars}}
|
88
|
-
|
89
|
-
{{^pocoModels}}
|
90
|
-
/// <summary>
|
91
|
-
/// Returns the string presentation of the object
|
92
|
-
/// </summary>
|
93
|
-
/// <returns>String presentation of the object</returns>
|
94
|
-
public override string ToString()
|
95
|
-
{
|
96
|
-
var sb = new StringBuilder();
|
97
|
-
sb.Append("class {{classname}} {\n");
|
98
|
-
{{#vars}}
|
99
|
-
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
100
|
-
{{/vars}}
|
101
|
-
sb.Append("}\n");
|
102
|
-
return sb.ToString();
|
103
|
-
}
|
104
|
-
|
105
|
-
/// <summary>
|
106
|
-
/// Returns the JSON string presentation of the object
|
107
|
-
/// </summary>
|
108
|
-
/// <returns>JSON string presentation of the object</returns>
|
109
|
-
public {{#parent}}{{^isMap}}{{^isArray}}new {{/isArray}}{{/isMap}}{{/parent}}string ToJson()
|
110
|
-
{
|
111
|
-
{{#useNewtonsoft}}
|
112
|
-
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
113
|
-
{{/useNewtonsoft}}
|
114
|
-
{{^useNewtonsoft}}
|
115
|
-
var options = new JsonSerializerOptions
|
116
|
-
{
|
117
|
-
WriteIndented = true
|
118
|
-
};
|
119
|
-
|
120
|
-
return JsonSerializer.Serialize(this, options);
|
121
|
-
{{/useNewtonsoft}}
|
122
|
-
}
|
123
|
-
|
124
|
-
/// <summary>
|
125
|
-
/// Returns true if objects are equal
|
126
|
-
/// </summary>
|
127
|
-
/// <param name="obj">Object to be compared</param>
|
128
|
-
/// <returns>Boolean</returns>
|
129
|
-
public override bool Equals(object obj)
|
130
|
-
{
|
131
|
-
if (obj is null) return false;
|
132
|
-
if (ReferenceEquals(this, obj)) return true;
|
133
|
-
return obj.GetType() == GetType() && Equals(({{classname}})obj);
|
134
|
-
}
|
135
|
-
|
136
|
-
/// <summary>
|
137
|
-
/// Returns true if {{classname}} instances are equal
|
138
|
-
/// </summary>
|
139
|
-
/// <param name="other">Instance of {{classname}} to be compared</param>
|
140
|
-
/// <returns>Boolean</returns>
|
141
|
-
public bool Equals({{classname}} other)
|
142
|
-
{
|
143
|
-
if (other is null) return false;
|
144
|
-
if (ReferenceEquals(this, other)) return true;
|
145
|
-
|
146
|
-
return {{#vars}}{{^isContainer}}
|
147
|
-
(
|
148
|
-
{{name}} == other.{{name}} ||
|
149
|
-
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&{{/vendorExtensions.x-is-value-type}}
|
150
|
-
{{name}}.Equals(other.{{name}})
|
151
|
-
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
|
152
|
-
(
|
153
|
-
{{name}} == other.{{name}} ||
|
154
|
-
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&
|
155
|
-
other.{{name}} != null &&
|
156
|
-
{{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(other.{{name}})
|
157
|
-
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}false{{/vars}};
|
158
|
-
}
|
159
|
-
|
160
|
-
/// <summary>
|
161
|
-
/// Gets the hash code
|
162
|
-
/// </summary>
|
163
|
-
/// <returns>Hash code</returns>
|
164
|
-
public override int GetHashCode()
|
165
|
-
{
|
166
|
-
unchecked // Overflow is fine, just wrap
|
167
|
-
{
|
168
|
-
var hashCode = 41;
|
169
|
-
// Suitable nullity checks etc, of course :)
|
170
|
-
{{#vars}}
|
171
|
-
{{^vendorExtensions.x-is-value-type}}if ({{name}} != null){{/vendorExtensions.x-is-value-type}}
|
172
|
-
hashCode = hashCode * 59 + {{name}}.GetHashCode();
|
173
|
-
{{/vars}}
|
174
|
-
return hashCode;
|
175
|
-
}
|
176
|
-
}
|
177
|
-
|
178
|
-
#region Operators
|
179
|
-
#pragma warning disable 1591
|
180
|
-
|
181
|
-
public static bool operator ==({{classname}} left, {{classname}} right)
|
182
|
-
{
|
183
|
-
return Equals(left, right);
|
184
|
-
}
|
185
|
-
|
186
|
-
public static bool operator !=({{classname}} left, {{classname}} right)
|
187
|
-
{
|
188
|
-
return !Equals(left, right);
|
189
|
-
}
|
190
|
-
|
191
|
-
#pragma warning restore 1591
|
192
|
-
#endregion Operators
|
193
|
-
{{/pocoModels}}
|
194
|
-
}
|
195
|
-
{{/isEnum}}
|
196
|
-
{{/model}}
|
197
|
-
{{/models}}
|
198
|
-
}
|