Skip to content

Commit cc45f1f

Browse files
authored
Merge branch 'master' into issue_804
2 parents 8bd985c + a892f5e commit cc45f1f

File tree

459 files changed

+14963
-1752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

459 files changed

+14963
-1752
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "maven"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
ignore:
8+
- dependency-name: "*"
9+
update-types: ["version-update:semver-major"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Dependency Review'
2+
on: [pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
dependency-review:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Checkout Repository'
12+
uses: actions/checkout@v4
13+
- name: Dependency Review
14+
uses: actions/dependency-review-action@v3
15+
with:
16+
fail-on-severity: high

.github/workflows/maven-pr.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build Test PR
2+
3+
on:
4+
pull_request:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
build_pr:
9+
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
java: [ 8, 11, 17 ]
14+
15+
env:
16+
GENERATORS_VERSION_PROPERTY: ""
17+
steps:
18+
- uses: actions/checkout@v3
19+
name: git checkout
20+
- name: Set up Java
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: ${{ matrix.java }}
24+
distribution: temurin
25+
cache: maven
26+
- name: preliminary checks
27+
run: |
28+
docker login --username=${{ secrets.DOCKERHUB_SB_USERNAME }} --password=${{ secrets.DOCKERHUB_SB_PASSWORD }}
29+
set -e
30+
# fail if templates/generators contain carriage return '\r'
31+
/bin/bash ./bin/utils/detect_carriage_return.sh
32+
# fail if generators contain merge conflicts
33+
/bin/bash ./bin/utils/detect_merge_conflict.sh
34+
# fail if generators contain tab '\t'
35+
/bin/bash ./bin/utils/detect_tab_in_java_class.sh
36+
- uses: s4u/[email protected]
37+
name: setup maven settings.xml
38+
with:
39+
servers: |
40+
[{
41+
"id": "sonatype-nexus-staging",
42+
"username": "${{ secrets.OSSRH_USERNAME }}",
43+
"password": "${{ secrets.OSSRH_TOKEN }}"
44+
},
45+
{
46+
"id": "sonatype-nexus-snapshots",
47+
"username": "${{ secrets.OSSRH_USERNAME }}",
48+
"password": "${{ secrets.OSSRH_TOKEN }}"
49+
}]
50+
- name: Build with Maven
51+
if: ${{ matrix.java != 8 }}
52+
run: |
53+
export MY_POM_VERSION=`mvn -Dswagger-codegen-version=3.0.38 -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
54+
echo "POM VERSION" ${MY_POM_VERSION}
55+
export CODEGEN_VERSION=`sed -n 's/<swagger\-codegen\-version>\([^\s]*\)<\/swagger\-codegen\-version>/\1/p' pom.xml`
56+
export CODEGEN_VERSION=`echo ${CODEGEN_VERSION} | tr -d '[:space:]'`
57+
echo "CODEGEN_VERSION" ${CODEGEN_VERSION}
58+
export CODEGEN_VERSION_PROPERTY=""
59+
if [[ ! $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
60+
then
61+
if [[ ! $CODEGEN_VERSION =~ ^.*SNAPSHOT$ ]];
62+
then
63+
# check release version exists
64+
export CODEGEN_FOUND_JSON=`curl -s --max-time 60 --retry 15 --connect-timeout 20 https://search.maven.org/solrsearch/select?q=g:io.swagger.codegen.v3%20AND%20a:swagger-codegen%20AND%20v:${CODEGEN_VERSION}%20AND%20p:jar`
65+
export CODEGEN_FOUND=`echo ${CODEGEN_FOUND_JSON} | jq '.response.numFound'`
66+
echo "CODEGEN_FOUND" ${CODEGEN_FOUND}
67+
if [[ $CODEGEN_FOUND == '0' ]];
68+
then
69+
echo "codegen version not found"
70+
rm -f maven-metadata.json
71+
curl -o maven-metadata.json -s --max-time 60 --retry 15 --connect-timeout 30 -H "accept: application/json" https://oss.sonatype.org/service/local/repositories/snapshots/content/io/swagger/codegen/v3/swagger-codegen/
72+
LAST_SNAP=`jq '[.data | sort_by(.lastModified) | reverse | .[] | select( .text | contains("3."))]| .[0].text' maven-metadata.json`
73+
export LAST_SNAP=${LAST_SNAP:1:${#LAST_SNAP}-2}
74+
echo "LAST_SNAP $LAST_SNAP"
75+
export CODEGEN_VERSION_PROPERTY=-Dswagger-codegen-version=$LAST_SNAP
76+
fi
77+
fi
78+
fi
79+
echo "CODEGEN_VERSION_PROPERTY ${CODEGEN_VERSION_PROPERTY}"
80+
echo "CODEGEN_VERSION_PROPERTY=${CODEGEN_VERSION_PROPERTY}" >> $GITHUB_ENV
81+
./mvnw clean verify -U ${CODEGEN_VERSION_PROPERTY}

.github/workflows/maven-push.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build Test Push
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
build_push:
9+
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
java: [ 8, 11, 17 ]
14+
15+
env:
16+
GENERATORS_VERSION_PROPERTY: ""
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
name: git checkout
21+
with:
22+
ref: master
23+
- name: Set up Java
24+
uses: actions/setup-java@v3
25+
with:
26+
java-version: ${{ matrix.java }}
27+
distribution: temurin
28+
cache: maven
29+
- name: preliminary checks
30+
run: |
31+
docker login --username=${{ secrets.DOCKERHUB_SB_USERNAME }} --password=${{ secrets.DOCKERHUB_SB_PASSWORD }}
32+
set -e
33+
# fail if templates/generators contain carriage return '\r'
34+
/bin/bash ./bin/utils/detect_carriage_return.sh
35+
# fail if generators contain merge conflicts
36+
/bin/bash ./bin/utils/detect_merge_conflict.sh
37+
# fail if generators contain tab '\t'
38+
/bin/bash ./bin/utils/detect_tab_in_java_class.sh
39+
- uses: s4u/[email protected]
40+
name: setup maven settings.xml
41+
with:
42+
servers: |
43+
[{
44+
"id": "sonatype-nexus-staging",
45+
"username": "${{ secrets.OSSRH_USERNAME }}",
46+
"password": "${{ secrets.OSSRH_TOKEN }}"
47+
},
48+
{
49+
"id": "sonatype-nexus-snapshots",
50+
"username": "${{ secrets.OSSRH_USERNAME }}",
51+
"password": "${{ secrets.OSSRH_TOKEN }}"
52+
}]
53+
- name: Build with Maven
54+
if: ${{ matrix.java != 8 }}
55+
run: |
56+
export MY_POM_VERSION=`mvn -Dswagger-codegen-version=3.0.38 -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
57+
echo "POM VERSION" ${MY_POM_VERSION}
58+
export CODEGEN_VERSION=`sed -n 's/<swagger\-codegen\-version>\([^\s]*\)<\/swagger\-codegen\-version>/\1/p' pom.xml`
59+
export CODEGEN_VERSION=`echo ${CODEGEN_VERSION} | tr -d '[:space:]'`
60+
echo "CODEGEN_VERSION" ${CODEGEN_VERSION}
61+
export CODEGEN_VERSION_PROPERTY=""
62+
if [[ ! $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
63+
then
64+
if [[ ! $CODEGEN_VERSION =~ ^.*SNAPSHOT$ ]];
65+
then
66+
# check release version exists
67+
export CODEGEN_FOUND_JSON=`curl -s --max-time 60 --retry 15 --connect-timeout 20 https://search.maven.org/solrsearch/select?q=g:io.swagger.codegen.v3%20AND%20a:swagger-codegen%20AND%20v:${CODEGEN_VERSION}%20AND%20p:jar`
68+
export CODEGEN_FOUND=`echo ${CODEGEN_FOUND_JSON} | jq '.response.numFound'`
69+
echo "CODEGEN_FOUND" ${CODEGEN_FOUND}
70+
if [[ $CODEGEN_FOUND == '0' ]];
71+
then
72+
echo "codegen version not found"
73+
rm -f maven-metadata.json
74+
curl -o maven-metadata.json -s --max-time 60 --retry 15 --connect-timeout 30 -H "accept: application/json" https://oss.sonatype.org/service/local/repositories/snapshots/content/io/swagger/codegen/v3/swagger-codegen/
75+
LAST_SNAP=`jq '[.data | sort_by(.lastModified) | reverse | .[] | select( .text | contains("3."))]| .[0].text' maven-metadata.json`
76+
export LAST_SNAP=${LAST_SNAP:1:${#LAST_SNAP}-2}
77+
echo "LAST_SNAP $LAST_SNAP"
78+
export CODEGEN_VERSION_PROPERTY=-Dswagger-codegen-version=$LAST_SNAP
79+
fi
80+
fi
81+
fi
82+
echo "CODEGEN_VERSION_PROPERTY ${CODEGEN_VERSION_PROPERTY}"
83+
echo "CODEGEN_VERSION_PROPERTY=${CODEGEN_VERSION_PROPERTY}" >> $GITHUB_ENV
84+
./mvnw clean verify -U ${CODEGEN_VERSION_PROPERTY}
85+
- name: Deploy Maven Snapshot
86+
if: ${{ matrix.java == 17 }}
87+
run: |
88+
export MY_POM_VERSION=`mvn -Dswagger-codegen-version=3.0.38 -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
89+
echo "POM VERSION" ${MY_POM_VERSION}
90+
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
91+
then
92+
./mvnw clean deploy -U --settings $HOME/.m2/settings.xml
93+
else
94+
echo "not deploying release: " ${MY_POM_VERSION}
95+
fi
96+

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
# Log file
55
*.log
66

7+
# Temporary files
8+
*.tmp
9+
tmp/
10+
711
# BlueJ files
812
*.ctxt
913

.mvn/wrapper/maven-wrapper.jar

100755100644
11.3 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

.whitesource

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"settingsInheritedFrom": "swagger-api/whitesource-config@main"
3+
}

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Overview
88
**Swagger Codegen Generators** project is a set of classes and templates ([Handlebars](https://jknack.github.io/handlebars.java)) used by [Swagger Codegen 3.0.0 project](https://github.com/swagger-api/swagger-codegen/tree/3.0.0) in its code generation process for a specific language or language framework. The main differents with **Swagger Codegen 2.x.x** are:
99

10-
- **Handlebars as template engine:** with Handelbars feature is possible to create more logic-less templates.
10+
- **Handlebars as template engine:** with Handlebars feature is possible to create more logic-less templates.
1111
- **OAS 3 support:** generator classes work with OpenAPI Specification V3.
1212

1313
More details about these and more differences are referenced at [https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.0](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.0)
@@ -18,16 +18,16 @@ You need the following installed and available in your $PATH:
1818
* Java 8 (http://java.oracle.com)
1919
* Apache maven 3.0.4 or greater (http://maven.apache.org/)
2020

21-
## How to contribute.
22-
Right now the templates and generators classes are migrated from [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) **3.0.0** branch.
21+
## How to Contribute.
22+
Right now the templates and generators classes are migrated from [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) **3.0.0** branch.
2323
If you want to migrate an existing language/framework, you can follow this [guide](https://github.com/swagger-api/swagger-codegen/wiki/Swagger-Codegen-migration-(swagger-codegen-generators-repository)).
24-
Also you need to keep in mind that **Handlebars** is used as template engines and besides it's pretty similar to **Mustache** there are different that can not be ignored. So you can follow this [guide](https://github.com/swagger-api/swagger-codegen/wiki/Swagger-Codegen-migration-from-Mustache-and-Handlebars-templates.) which explains steps to migrate templates from **Mustaches** to **Handelbars**.
24+
Also you need to keep in mind that **Handlebars** is used as the template engine. It's pretty similar to **Mustache**, but there are differences that can not be ignored. So you can follow this [guide](https://github.com/swagger-api/swagger-codegen/wiki/Swagger-Codegen-migration-from-Mustache-and-Handlebars-templates.) which explains steps to migrate templates from **Mustaches** to **Handlebars**.
2525

26-
## Security contact
26+
## Security Contact
2727

2828
Please disclose any security-related issues or vulnerabilities by emailing [[email protected]](mailto:[email protected]), instead of using the public issue tracker.
2929

30-
## License information on Generated Code
30+
## License Information on Generated Code
3131

3232
The Swagger Codegen project is intended as a benefit for users of the Swagger / Open API Specification. The project itself has the [License](#license) as specified. In addition, please understand the following points:
3333

0 commit comments

Comments
 (0)