File Contention in Development Builds
### File Contention in Development Builds
Since `./vai` and ThorAPI in general do a lot of file moving/deleting/creating typically inline to an active IDE running various parts of the project at any one time, sometimes errors can be caused by the fact that an IDE has a source file open, or a classpath file is locked for any reason, a path cannot be deleted, or an unexpected condition (including full disks, disk I/O problems, bad path or filename characters, corrupt files, etc.).
These errors list random filenames, often while compiling AspectJ:
```bash
[INFO] --- jar:3.4.2:jar (default-jar) @ generator ---
[INFO] BUILD FAILURE
...
The solution is to close all IDE windows, terminals, and kill any process that is possibly holding open a file in the project path. Then rerun the build:
Since `./vai` and ThorAPI in general do a lot of file moving/deleting/creating typically inline to an active IDE running various parts of the project at any one time, sometimes errors can be caused by the fact that an IDE has a source file open, or a classpath file is locked for any reason, a path cannot be deleted, or an unexpected condition (including full disks, disk I/O problems, bad path or filename characters, corrupt files, etc.).
These errors list random filenames, often while compiling AspectJ:
```bash
[INFO] --- jar:3.4.2:jar (default-jar) @ generator ---
[INFO] BUILD FAILURE
...
The solution is to close all IDE windows, terminals, and kill any process that is possibly holding open a file in the project path. Then rerun the build:
mvn clean install -DskipTestsmvn clean install -DskipTests
Spec Validation Errors
The generator validates the input specifications before generating code. If there is a problem, you might see an error like this:
[ERROR]
org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
NOTE: it is NOT recommended to skip validation of the specification. Doing so will likely introduce bugs and code that will not compile, if it produces anything at all.
Missing Required Fields
Ensure all required fields are properly specified in your OpenAPI spec and database schema.
Validation Conflicts
Check for conflicting validation rules in your OpenAPI spec that may prevent data from being processed correctly.
For example:
someData:
maxLength: 10
minLength: 20
type: string
description: this is broken data cannot be inserted
Common Spec Problems
String Columns Too Large
Currently, there are some boundary issues when choosing values for string "maxLength". Some databases only support creation of VARCHAR columns which are limited to approximately 16k characters in length. When trying to create a 20k size character column, it fails to 'upcast' to a larger 'text' type.
...
bioUrl:
type: string
description: More in-depth information about you and your account
maxLength: 20000
...
The workaround is to choose a significantly higher size which will force the properly sized column:
...
bioUrl:
type: string
description: More in-depth information about you and your account
maxLength: 100000
...
Non-Fatal Test Errors
During Maven test runs, you may encounter Spring JPA DML/DDL issues creating tables for tests using the H2 embedded database engine. These may or may not impact your testing depending upon whether your test code touches upon the tables that are not able to be created.
Duplicating Generated Props
You must avoid manually adding duplicate auto-generated fields like id
or created_date
to your OpenAPI spec. ThorAPI may or may not dedupe the spec properly, and this will likely introduce potential bugs and malfunctioning of the code that depends on these fields.
Unsupported OpenAPI Features
Check for unsupported features in your OpenAPI spec that may lead to errors during code generation or runtime.