Generating SpringBoot Server Code
Option 1: Installing OpenAPI Generator CLI
1. Install the OpenAPI Generator CLI:
- macOS/Linux:
brew install openapi-generator
- Using npm (Node.js):
npm install @openapitools/openapi-generator-cli -g
Command
Run the following command using the installed CLI:
openapi-generator-cli generate \
-i /local/api-spec.yaml \
-g spring \
-o /local/out/spring \
-p generateApiTests=true \
-p generateModelTests=true \
-p interfaceOnly=false \
-p delegatePattern=true \
--additional-properties="\
groupId=com.nettom.tmfXXX,\
artifactId=tmfXXX-api,\
artifactVersion=v4,\
springBootVersion=2.7.18,\
java8=true,\
basePackage=com.nettom.tmfXXX.v4,\
apiPackage=com.nettom.tmfXXX.v4.api,\
modelPackage=com.nettom.tmfXXX.v4.model,\
configPackage=com.nettom.tmfXXX.v4.config\
"
Additional Instructions
Make sure to replace the following values in the command for both Option 1 and Option 2:
1. API Specification File
- In the second line, replace api-spec.yaml with the correct TMF API specification file.
- Example:
- Go to ACE 8 - TMF642 and download the Raw JSON API.
- Save the file. The default name will be something like:
TMF642_Alarm_Management_API_v4.0.0_swagger.json
- Update the second line of the command:
to:
-i /local/TMF642_Alarm_Management_API_v4.0.0_swagger.json
2. Replace TMF Number
- Replace tmfXXX in the groupId or artifactId properties with the correct TMF number for your API (e.g., tmf642).
3. API Version
- If you have a newer version (e.g., v5), update the references from v4 to v5 in the filename and artifactVersion.
Option 2 (Using Docker)
If you have Docker installed, you can use the following command:
docker run --rm \
-v "$PWD:/local" \
openapitools/openapi-generator-cli generate \
-i /local/api-spec.yaml \
-g spring \
-o /local/out/spring \
-p generateApiTests=true \
-p generateModelTests=true \
-p interfaceOnly=false \
-p delegatePattern=true \
--additional-properties="\
groupId=com.nettom.tmfXXX,\
artifactId=tmfXXX-api,\
artifactVersion=v4,\
springBootVersion=2.7.18,\
java8=true,\
basePackage=com.nettom.tmfXXX.v4,\
apiPackage=com.nettom.tmfXXX.v4.api,\
modelPackage=com.nettom.tmfXXX.v4.model,\
configPackage=com.nettom.tmfXXX.v4.config\
"
Note: Follow the same Additional Instructions for this option to replace the API specification file, TMF number, and version appropriately.
Generating SpringBoot Server Code
Option 1: Installing OpenAPI Generator CLI
1. Install the OpenAPI Generator CLI:
Command
Run the following command using the installed CLI:
openapi-generator-cli generate \ -i /local/api-spec.yaml \ -g spring \ -o /local/out/spring \ -p generateApiTests=true \ -p generateModelTests=true \ -p interfaceOnly=false \ -p delegatePattern=true \ --additional-properties="\ groupId=com.nettom.tmfXXX,\ artifactId=tmfXXX-api,\ artifactVersion=v4,\ springBootVersion=2.7.18,\ java8=true,\ basePackage=com.nettom.tmfXXX.v4,\ apiPackage=com.nettom.tmfXXX.v4.api,\ modelPackage=com.nettom.tmfXXX.v4.model,\ configPackage=com.nettom.tmfXXX.v4.config\ "Additional Instructions
Make sure to replace the following values in the command for both Option 1 and Option 2:
1. API Specification File
to:
2. Replace TMF Number
3. API Version
Option 2 (Using Docker)
If you have Docker installed, you can use the following command:
docker run --rm \ -v "$PWD:/local" \ openapitools/openapi-generator-cli generate \ -i /local/api-spec.yaml \ -g spring \ -o /local/out/spring \ -p generateApiTests=true \ -p generateModelTests=true \ -p interfaceOnly=false \ -p delegatePattern=true \ --additional-properties="\ groupId=com.nettom.tmfXXX,\ artifactId=tmfXXX-api,\ artifactVersion=v4,\ springBootVersion=2.7.18,\ java8=true,\ basePackage=com.nettom.tmfXXX.v4,\ apiPackage=com.nettom.tmfXXX.v4.api,\ modelPackage=com.nettom.tmfXXX.v4.model,\ configPackage=com.nettom.tmfXXX.v4.config\ "Note: Follow the same Additional Instructions for this option to replace the API specification file, TMF number, and version appropriately.