documentation

This commit is contained in:
Wolfgang Hottgenroth 2021-11-25 17:57:07 +01:00
parent 73005d9657
commit df3284fe71
Signed by: wn
GPG Key ID: E49AF3B9EF6DD469

View File

@ -1,38 +1,24 @@
Details on OpenAPI spec: https://swagger.io/specification/
Generate server stubs:
To build, use the script generateAll.sh. Before running this script, load the ENV file with
the PACKAGE_NAME variable.
docker run -it --rm -v $PWD:/work -u $UID openapitools/openapi-generator:cli-v5.1.0 \
generate -i /work/openapi.yaml -g aspnetcore -o /work/output \
--package-name $PACKAGE_NAME \
--additional-properties="packageVersion=0.0.1,aspnetCoreVersion=5.0,operationIsAsync=true,modelPropertyNaming=camelCase,\
generateBody=false,classModifier=abstract,operationModifier=abstract"
Options of the script are:
r ... Remove stall output directory
1 ... generate implementation code
2 ... generate OpenAPI server stub code, patch required files and copy implementation code
into the generated source tree
b ... build the while service
x ... execute the service
Configuration details for generator: https://openapi-generator.tech/docs/generators/aspnetcore/
Configuration for the service is injected using environment variables:
Build and run the stub webservice:
docker run -it --rm -p 8080:8080 -v $PWD:/work \
registry.hottis.de/dockerized/dotnetcore5sdk:1.0.0 \
bash
ATTENTION: This won't work with a set UID
Build:
sh build.sh
Run:
dotnet run -p src/$PACKAGE_NAME/$PACKAGE_NAME.csproj
Database__Host
Database__User
Database__Password
Database__Name
From output/src/$PACKAGE_NAME:
* dotnet add package MySqlConnector --version 2.0.0
* make implementations directory
* copy generate endpoint implementation code to implementations directory