Initial generation files

This commit is contained in:
fterrot 2021-02-28 21:29:24 +01:00
parent dbf8287a78
commit 97a6f5c8cd
2 changed files with 90 additions and 0 deletions

41
config.yaml Normal file
View File

@ -0,0 +1,41 @@
#
# MIT License Copyright (c) 2021 F.Terrot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
generatorName: java
apiPackage: io.gitea.api
artifactDescription: Access GITEA services in Java.
artifactId: java.gitea.api
artifactUrl: https://forge.chapril.org/gitea/java.gitea.api
artifactVersion: 1.13.0
developerEmail: fterrot<@>april.org
developerName: Gitea Contributors, OpenAPI-generator Contributors
developerOrganisation: none
developerOragnisationUrl: https://gitea.io/
groupId: io.gitea
hideGenerationTimestamp: true
invokerPackage: io.gitea
licenseName: MIT
modelPackage: io.gitea.model
scmUrl: https://forge.chapril.org/gitea/java.gitea.api
snapshotVersion: false # true for master
java8: true
dateLibrary: java8

49
generate.sh Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
#
# MIT License Copyright (c) 2021 F.Terrot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
gitea_version=1.13
openapi_codegen_version=5.0.1
gitea_api_json=swagger.${gitea_version}.json
openapi_codegen_jar=openapi-generator-cli-${openapi_codegen_version}.jar
openapi_codegen_baseurl=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli
openapi_codegen="java -jar ${openapi_codegen_jar}"
if [ ${gitea_version} = "master" ] ; then
gitea_api_json_url=https://raw.githubusercontent.com/go-gitea/gitea/master/templates/swagger/v1_json.tmpl
else
gitea_api_json_url=https://raw.githubusercontent.com/go-gitea/gitea/release/v${gitea_version}/templates/swagger/v1_json.tmpl
fi
curl ${gitea_api_json_url} --output ${gitea_api_json}
sed -i s/{{AppSubUrl}}//g ${gitea_api_json}
[ ! -f ${openapi_codegen_jar} ] && curl ${openapi_codegen_baseurl}/${openapi_codegen_version}/${openapi_codegen_jar} -O
if [ -f ${openapi_codegen_jar} ] ; then
${openapi_codegen} validate -i ${gitea_api_json} || (echo "**ERROR ** JSON Validation issue" && exit 1)
${openapi_codegen} generate --additional-properties=java8=true -i ${gitea_api_json} -c config.yaml -o . || (echo "** ERROR ** Code Generation issue" && exit 2)
mvn -Dmaven.javadoc.skip=true package
else
echo "Missing ${openapi_codegen_jar}"
fi