Getting Started with ValkyrAI
Prerequisites
Before you begin, ensure you have the following software installed:
-
Java Development Kit (JDK) 11 or higher: Download JDK
-
Apache Maven 3.6 or higher: Download Maven
-
Node.js and npm (for TypeScript client development): Download Node.js
-
ThorAPI Enhancer Tool: Available from the ThorAPI repository.
Getting Started with ValkyrAI
Prerequisites
Before you begin, ensure you have the following software installed:
- Java Development Kit (JDK) 11 or higher: Download JDK
- Apache Maven 3.6 or higher: Download Maven
- Node.js and npm (for TypeScript client development): Download Node.js
- GitHub Account: Required for GitHub integration.
- ThorAPI Enhancer Tool: Available from the ThorAPI repository.
Generation Steps
Follow these steps to generate your API and client code:
1. Enhance Your OpenAPI Specification
-
Incorporate CRUD Operations: Define create, read, update, and delete operations in your API definitions.
-
Include ValkyrAI-Specific Annotations: Utilize annotations such as
@SecureField
and@DataField
to enhance security and data handling. -
Add Required Fields: Ensure fields like
last_modified_date
andowner_id
are included in your models.
2. Generate Code
-
Spring Boot Service:
- Generate RESTful CRUD APIs with integrated JPA backend.
-
TypeScript Client:
- Generate a fetch-based API client.
- Include end-to-end validation with Jest testing.
3. Run the Service
-
Deploy Your Service: Run your generated Spring Boot microservices.
-
Database Connection: Connect to your preferred database and configure settings as needed.
Enhancing OpenAPI Spec and Generating Liquibase Scripts
Use the ThorAPI
tool to process and merge your OpenAPI templates.
Input Files:
src/main/resources/openapi/api.yaml
: Your base OpenAPI specification.src/main/resources/openapi/api.hbs
: The ThorAPI Handlebars template.
Command:
java -jar thorapi/target/thorapi-1.0-SNAPSHOT-exec.jar \
src/main/resources/openapi/api.yaml \
src/main/resources/openapi/output-api.yaml \
src/main/resources/openapi/api
To launch your generated Spring Boot REST Service, you will need to set the appropriate parameters.
For basic operation, you will need a JWT key and a THORAPI_SECRET_KEY.
To generate the JWT secret, use:
cd src/main/typescript/valkyr_labs_com
yarn generate-jwt-key