This is a golang tool to convert bean structures found in an openapi.yaml
file into java transport beans, for use in the Galasa server.
We do this to make sure that the java code uses the exact same structure as the openapi.yaml
declares.
During the build of the framework project, the openapi.yaml
file is obtained, and java transport beans rendered.
Run this script:
./build-locally.sh
./bin/openapi2beans-${operatingSystem}-${hardwareArchitecture} \
--api ${filePathToOpenAPI} \
--outputFolder ${outputFolder}
Where operatingSystem is darwin
or linux
and hardwareArchitecture is x86_64
or arm64
For example:
./bin/openapi2beans-darwin-arm64 \
--api myRestApiDefinition.yaml \
--outputFolder temp/generated
The tool is split into several parts:
- read the yaml file from disk into memory
- convert the yaml data into a set of
SchemaType
in-memory objects - for each in-memory
SchemaType
object...- convert the
SchemaType
in-memory object into a.java
file image in memory - write the in-memory java file image to disk
- convert the
- Report overall status
The overall design can be split into components: