Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mwiehl authored Nov 27, 2023
2 parents c602c1f + a0a349a commit 5b150f4
Show file tree
Hide file tree
Showing 1,540 changed files with 37,471 additions and 53,034 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
16 changes: 16 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: Dependency Review
uses: actions/dependency-review-action@v3
with:
fail-on-severity: high
81 changes: 81 additions & 0 deletions .github/workflows/maven-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build Test PR

on:
pull_request:
branches: [ "master" ]

jobs:
build_pr:

runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 17 ]

env:
GENERATORS_VERSION_PROPERTY: ""
steps:
- uses: actions/checkout@v3
name: git checkout
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven
- name: preliminary checks
run: |
docker login --username=${{ secrets.DOCKERHUB_SB_USERNAME }} --password=${{ secrets.DOCKERHUB_SB_PASSWORD }}
set -e
# fail if templates/generators contain carriage return '\r'
/bin/bash ./bin/utils/detect_carriage_return.sh
# fail if generators contain merge conflicts
/bin/bash ./bin/utils/detect_merge_conflict.sh
# fail if generators contain tab '\t'
/bin/bash ./bin/utils/detect_tab_in_java_class.sh
- uses: s4u/maven-settings-action@v2.8.0
name: setup maven settings.xml
with:
servers: |
[{
"id": "sonatype-nexus-staging",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
},
{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
}]
- name: Build with Maven
if: ${{ matrix.java != 8 }}
run: |
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`
echo "POM VERSION" ${MY_POM_VERSION}
export CODEGEN_VERSION=`sed -n 's/<swagger\-codegen\-version>\([^\s]*\)<\/swagger\-codegen\-version>/\1/p' pom.xml`
export CODEGEN_VERSION=`echo ${CODEGEN_VERSION} | tr -d '[:space:]'`
echo "CODEGEN_VERSION" ${CODEGEN_VERSION}
export CODEGEN_VERSION_PROPERTY=""
if [[ ! $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
if [[ ! $CODEGEN_VERSION =~ ^.*SNAPSHOT$ ]];
then
# check release version exists
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`
export CODEGEN_FOUND=`echo ${CODEGEN_FOUND_JSON} | jq '.response.numFound'`
echo "CODEGEN_FOUND" ${CODEGEN_FOUND}
if [[ $CODEGEN_FOUND == '0' ]];
then
echo "codegen version not found"
rm -f maven-metadata.json
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/
LAST_SNAP=`jq '[.data | sort_by(.lastModified) | reverse | .[] | select( .text | contains("3."))]| .[0].text' maven-metadata.json`
export LAST_SNAP=${LAST_SNAP:1:${#LAST_SNAP}-2}
echo "LAST_SNAP $LAST_SNAP"
export CODEGEN_VERSION_PROPERTY=-Dswagger-codegen-version=$LAST_SNAP
fi
fi
fi
echo "CODEGEN_VERSION_PROPERTY ${CODEGEN_VERSION_PROPERTY}"
echo "CODEGEN_VERSION_PROPERTY=${CODEGEN_VERSION_PROPERTY}" >> $GITHUB_ENV
./mvnw clean verify -U ${CODEGEN_VERSION_PROPERTY}
96 changes: 96 additions & 0 deletions .github/workflows/maven-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build Test Push

on:
push:
branches: [ "master" ]

jobs:
build_push:

runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 17 ]

env:
GENERATORS_VERSION_PROPERTY: ""

steps:
- uses: actions/checkout@v3
name: git checkout
with:
ref: master
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven
- name: preliminary checks
run: |
docker login --username=${{ secrets.DOCKERHUB_SB_USERNAME }} --password=${{ secrets.DOCKERHUB_SB_PASSWORD }}
set -e
# fail if templates/generators contain carriage return '\r'
/bin/bash ./bin/utils/detect_carriage_return.sh
# fail if generators contain merge conflicts
/bin/bash ./bin/utils/detect_merge_conflict.sh
# fail if generators contain tab '\t'
/bin/bash ./bin/utils/detect_tab_in_java_class.sh
- uses: s4u/maven-settings-action@v2.8.0
name: setup maven settings.xml
with:
servers: |
[{
"id": "sonatype-nexus-staging",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
},
{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_TOKEN }}"
}]
- name: Build with Maven
if: ${{ matrix.java != 8 }}
run: |
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`
echo "POM VERSION" ${MY_POM_VERSION}
export CODEGEN_VERSION=`sed -n 's/<swagger\-codegen\-version>\([^\s]*\)<\/swagger\-codegen\-version>/\1/p' pom.xml`
export CODEGEN_VERSION=`echo ${CODEGEN_VERSION} | tr -d '[:space:]'`
echo "CODEGEN_VERSION" ${CODEGEN_VERSION}
export CODEGEN_VERSION_PROPERTY=""
if [[ ! $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
if [[ ! $CODEGEN_VERSION =~ ^.*SNAPSHOT$ ]];
then
# check release version exists
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`
export CODEGEN_FOUND=`echo ${CODEGEN_FOUND_JSON} | jq '.response.numFound'`
echo "CODEGEN_FOUND" ${CODEGEN_FOUND}
if [[ $CODEGEN_FOUND == '0' ]];
then
echo "codegen version not found"
rm -f maven-metadata.json
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/
LAST_SNAP=`jq '[.data | sort_by(.lastModified) | reverse | .[] | select( .text | contains("3."))]| .[0].text' maven-metadata.json`
export LAST_SNAP=${LAST_SNAP:1:${#LAST_SNAP}-2}
echo "LAST_SNAP $LAST_SNAP"
export CODEGEN_VERSION_PROPERTY=-Dswagger-codegen-version=$LAST_SNAP
fi
fi
fi
echo "CODEGEN_VERSION_PROPERTY ${CODEGEN_VERSION_PROPERTY}"
echo "CODEGEN_VERSION_PROPERTY=${CODEGEN_VERSION_PROPERTY}" >> $GITHUB_ENV
./mvnw clean verify -U ${CODEGEN_VERSION_PROPERTY}
- name: Deploy Maven Snapshot
if: ${{ matrix.java == 17 }}
run: |
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`
echo "POM VERSION" ${MY_POM_VERSION}
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]];
then
./mvnw clean deploy -U --settings $HOME/.m2/settings.xml
else
echo "not deploying release: " ${MY_POM_VERSION}
fi
15 changes: 7 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# Log file
*.log

# Temporary files
*.tmp
tmp/

# BlueJ files
*.ctxt

Expand All @@ -14,18 +18,13 @@
# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea
*.iml
target/
test-output/

.classpath
.settings/
Binary file modified .mvn/wrapper/maven-wrapper.jar
100755 → 100644
Binary file not shown.
19 changes: 18 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
3 changes: 3 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"settingsInheritedFrom": "swagger-api/whitesource-config@main"
}
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright 2020 SmartBear Software Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# <img src="https://raw.githubusercontent.com/swagger-api/swagger.io/wordpress/images/assets/SWC-logo-clr.png" height="80">

- Master: [![Build Status](https://img.shields.io/jenkins/s/https/jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-generators-master-java-8.svg)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-generators-master-java-8)
- Master: [![Build Status](https://img.shields.io/jenkins/build.svg?jobUrl=https://jenkins.swagger.io/job/oss-swagger-codegen-generators-master-java-8)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-generators-master-java-8)

[![Build Status](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-generators-master-java-8/badge/icon?subject=jenkins%20build%20-%20master)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-generators-master-java-8/)

## Overview
**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:

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

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)
Expand All @@ -16,23 +18,20 @@ You need the following installed and available in your $PATH:
* Java 8 (http://java.oracle.com)
* Apache maven 3.0.4 or greater (http://maven.apache.org/)

## How to contribute.
Right now the templates and generators classes are migrated from [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) **3.0.0** branch.
## How to Contribute.
Right now the templates and generators classes are migrated from [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) **3.0.0** branch.
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)).
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**.

License
-------

Copyright 2019 SmartBear Software

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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**.

## Security Contact

Please disclose any security-related issues or vulnerabilities by emailing [security@swagger.io](mailto:security@swagger.io), instead of using the public issue tracker.

## License Information on Generated Code

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:

* The templates included with this project are subject to the [License](#license).
* Generated code is intentionally _not_ subject to the parent project license

When code is generated from this project, it shall be considered **AS IS** and owned by the user of the software. There are no warranties--expressed or implied--for generated code. You can do what you wish with it, and once generated, the code is your responsibility and subject to the licensing terms that you deem appropriate.
Loading

0 comments on commit 5b150f4

Please sign in to comment.