### Perform an As-Of Query
Source: https://liftwizard.io/docs/temporal-data/as-of-queries
Example of a GET request to retrieve a blueprint's state at a specific point in time.
```http
GET /api/blueprint/{blueprintKey}?asOf=2001-01-03T23:59:59Z
```
--------------------------------
### Running Liftwizard Example with Environment Variable Substitution
Source: https://liftwizard.io/docs/configuration/environment-variable-substitution
Demonstrates how to run the Liftwizard example application with and without the DW_DEFAULT_NAME environment variable set, showing the effect of substitution.
```bash
$ java -jar target/liftwizard-example-0.1.0.jar render example.yml --include-default
INFO [2020-05-02 03:07:41,910] com.example.helloworld.cli.RenderCommand: DEFAULT => Hello, Stranger!
$ DW_DEFAULT_NAME=EnvSubstitution java -jar target/liftwizard-example-0.1.0.jar render example.yml --include-default
INFO [2020-05-02 03:08:05,685] com.example.helloworld.cli.RenderCommand: DEFAULT => Hello, EnvSubstitution!
```
--------------------------------
### Original Configuration File Example
Source: https://liftwizard.io/docs/configuration/ConfigLoggingBundle
This is an example of an original configuration file (e.g., JSON5) before being processed and logged by ConfigLoggingBundle. Note that it is more concise than the output configuration.
```json
{
"configLogging": {
"enabled": true
},
"template": "Hello, %s!"
}
```
--------------------------------
### Equality Operator Examples
Source: https://liftwizard.io/docs/reladomo/reladomo-operation-compiler
Illustrates the syntax for equality and inequality checks, including null checks and list membership.
```text
# Equality operators
this.stringProperty = "Value"
this.stringProperty != "Value"
this.stringProperty is null
this.stringProperty == null
this.stringProperty is not null
this.stringProperty != null
this.stringProperty in ["Value", "Value2", null]
this.stringProperty not in ["Value", "Value2", null]
```
--------------------------------
### Configure Logback Appender
Source: https://liftwizard.io/docs/logging/Slf4jUncaughtExceptionHandlerBundle
Example Logback configuration pattern for displaying uncaught exception logs.
```xml
%highlight(%-5level) %cyan(%date{HH:mm:ss.SSS, ${LOGGING_TIMEZONE}}) %gray(\(%file:%line\)) [%white(%thread)] %blue(%marker) {%magenta(%mdc)} %green(%logger): %message%n%rootException
```
--------------------------------
### Configure Maven Install Plugin
Source: https://liftwizard.io/docs/maven/minimal-parent
Defines the version for the Maven install plugin used during the installation phase.
```xml
org.apache.maven.plugins
maven-install-plugin
3.1.4
```
--------------------------------
### Conjunction Syntax Examples
Source: https://liftwizard.io/docs/reladomo/reladomo-operation-compiler
Shows the different ways to combine conditions using AND and OR operators, including their shorthand and keyword alternatives.
```text
# Conjunctions
this.booleanProperty = true & this.integerProperty = 4
this.booleanProperty = true && this.integerProperty = 4
this.booleanProperty = true and this.integerProperty = 4
this.booleanProperty = true | this.integerProperty = 4
this.booleanProperty = true || this.integerProperty = 4
this.booleanProperty = true or this.integerProperty = 4
```
--------------------------------
### Attribute Type Examples
Source: https://liftwizard.io/docs/reladomo/reladomo-operation-compiler
Demonstrates the syntax for specifying various attribute types including boolean, numeric, date, time, and string properties.
```text
# Attribute types
this.booleanProperty = true
this.integerProperty = 4
this.longProperty = 5
this.floatProperty = 6.6
this.doubleProperty = 7.7
this.dateProperty = "2010-12-31"
this.timeProperty = "2010-12-31T23:59:00.0Z"
this.stringProperty = "Value"
this.system = "2010-12-31T23:59:00.0Z"
```
--------------------------------
### Example Uncaught Exception Log Output
Source: https://liftwizard.io/docs/logging/Slf4jUncaughtExceptionHandlerBundle
Sample output format when an uncaught exception is logged by the handler.
```text
WARN 12:00:00.000 (Slf4jUncaughtExceptionHandler.java:46) [main] {exceptionClass=io.liftwizard.logging.slf4j.uncaught.exception.handler.Slf4jUncaughtExceptionHandlerTest.RootException, liftwizard.error.message=example root, liftwizard.error.kind=io.liftwizard.logging.slf4j.uncaught.exception.handler.Slf4jUncaughtExceptionHandlerTest.RootException, threadName=main, exceptionMessage=example root, liftwizard.error.thread=main} io.liftwizard.logging.slf4j.uncaught.exception.handler.Slf4jUncaughtExceptionHandler: Exception in thread "main"
io.liftwizard.logging.slf4j.uncaught.exception.handler.Slf4jUncaughtExceptionHandlerTest$CauseException: example cause
at io.liftwizard.logging.slf4j.uncaught.exception.handler.Slf4jUncaughtExceptionHandlerTest.testUncaughtException(Slf4jUncaughtExceptionHandlerTest.java:26) ~[test-classes/:na]
... 68 common frames omitted
Wrapped by: io.liftwizard.logging.slf4j.uncaught.exception.handler.Slf4jUncaughtExceptionHandlerTest$RootException: example root
at io.liftwizard.logging.slf4j.uncaught.exception.handler.Slf4jUncaughtExceptionHandlerTest.testUncaughtException(Slf4jUncaughtExceptionHandlerTest.java:27) ~[test-classes/:na]
```
--------------------------------
### String Operator Examples
Source: https://liftwizard.io/docs/reladomo/reladomo-operation-compiler
Demonstrates various string matching operations like endsWith, contains, startsWith, and wildcard matching, including their negated forms.
```text
# String operators
this.stringProperty endsWith "Value"
this.stringProperty contains "Value"
this.stringProperty startsWith "Value"
this.stringProperty wildCardEquals "Value?"
this.stringProperty not endsWith "Value"
this.stringProperty not contains "Value"
this.stringProperty not startsWith "Value"
this.stringProperty not wildCardEquals "Value?"
```
--------------------------------
### JUnit 5 Test with JsonMatchExtension
Source: https://liftwizard.io/docs/testing/matching-json
Example of setting up and using JsonMatchExtension in a JUnit 5 test class. This setup integrates with LiftwizardAppExtension for application testing.
```java
public class ExampleTest
{
@RegisterExtension
private final LiftwizardAppExtension> appExtension = this.getLiftwizardAppExtension();
@RegisterExtension
private final JsonMatchExtension jsonMatchExtension = new JsonMatchExtension(this.getClass());
@Nonnull
@Override
private LiftwizardAppExtension> getLiftwizardAppExtension()
{
return new LiftwizardAppExtension<>(
ExampleApplication.class,
ResourceHelpers.resourceFilePath("config-test.json5"));
}
@Test
public void smokeTest()
{
Response actualResponse = this.appExtension
.client()
.target("http://localhost:{port}/api/example")
.resolveTemplate("port", this.appExtension.getLocalPort())
.request()
.get();
String actualJsonResponse = actualResponse.readEntity(String.class);
String expectedResponseClassPathLocation = this.getClass().getSimpleName() + "." + testName + ".json";
this.jsonMatchExtension.assertFileContents(expectedResponseClassPathLocation, actualJsonResponse);
}
}
```
--------------------------------
### Named Data Sources Configuration (JSON5)
Source: https://liftwizard.io/docs/database/named-data-source
Example JSON5 configuration defining multiple named data sources, including H2 in-memory, H2 TCP, H2 file-based, and PostgreSQL.
```json
{
"dataSources": [
{
"name": "h2-mem",
"driverClass": "com.p6spy.engine.spy.P6SpyDriver",
"user": "sa",
"password": "",
"url": "jdbc:p6spy:h2:mem:;NON_KEYWORDS=USER"
},
{
"name": "h2-tcp",
"driverClass": "com.p6spy.engine.spy.P6SpyDriver",
"user": "sa",
"password": "",
"url": "jdbc:p6spy:h2:tcp://localhost:9092/liftwizard-app-h2;NON_KEYWORDS=USER"
},
{
"name": "h2-file",
"driverClass": "com.p6spy.engine.spy.P6SpyDriver",
"user": "sa",
"password": "",
"url": "jdbc:p6spy:h2:file:./target/h2db/liftwizard-app-h2;NON_KEYWORDS=USER"
},
{
"name": "postgres",
"driverClass": "org.postgresql.Driver",
"readOnlyByDefault": false,
"user": "${JDBC_DATABASE_USERNAME}",
"password": "${JDBC_DATABASE_PASSWORD}",
"url": "${JDBC_DATABASE_URL}"
}
]
}
```
--------------------------------
### GitHub Actions: Maven Verify Job
Source: https://liftwizard.io/docs/maven/profile-parent
This job runs Maven verification, including tests, on Ubuntu. It uses `jdx/mise-action` for environment setup.
```yaml
jobs:
maven-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- run: mvn verify
```
--------------------------------
### Numeric Operator Examples
Source: https://liftwizard.io/docs/reladomo/reladomo-operation-compiler
Shows the syntax for standard numeric comparison operators like greater than, less than, and their inclusive variants.
```text
# Numeric operators
this.stringProperty > "Value"
this.stringProperty >= "Value"
this.stringProperty < "Value"
this.stringProperty <= "Value"
```
--------------------------------
### Example Output Configuration JSON
Source: https://liftwizard.io/docs/configuration/ConfigLoggingBundle
This JSON represents the output configuration as logged by ConfigLoggingBundle. It includes values from the original configuration file and default values from Dropwizard's MetricsFactory.
```json
{
template: "Hello, %s!",
defaultName: "Stranger",
configLogging: {
enabled: true,
},
// ...
metrics: {
frequency: "1 minute",
reporters: [],
},
}
```
--------------------------------
### JUnit 5 FileMatchExtension Usage
Source: https://liftwizard.io/docs/testing/matching-files
Example implementation of the FileMatchExtension within a JUnit 5 test class.
```java
public class ExampleTest
{
@RegisterExtension
private final FileMatchExtension fileMatchExtension = new FileMatchExtension(this.getClass());
@Test
public void smokeTest()
{
String resourceClassPathLocation = this.getClass().getSimpleName() + ".txt";
this.fileMatchExtension.assertFileContents(resourceClassPathLocation, "test content");
}
}
```
--------------------------------
### Maven Plugin Phase Marker
Source: https://liftwizard.io/docs/maven/maven-best-practices
Example of region markers used in liftwizard-minimal-parent to label the Maven lifecycle phase for plugins.
```xml
org.apache.maven.plugins
maven-install-plugin
3.1.4
```
--------------------------------
### View Structured MDC Logging Output
Source: https://liftwizard.io/docs/logging/JerseyHttpLoggingBundle
Example of the structured log output generated by the StructuredArgumentsMDCLogger.
```text
DEBUG 13:21:49 [dw-249] io.liftwizard.servlet.logging.mdc.StructuredArgumentsMDCLogger: Response sent <> <
response.http.elapsedNanos=1000000000,
request.http.method=GET,
request.http.parameters.query.name=Dr. IntegrationTest,
request.http.path.full=/hello-world,
request.http.path.absolute=http://localhost:63842/hello-world,
request.http.client.port=63855,
request.http.headers.User-Agent=Jersey/2.25.1 (HttpUrlConnection 17.0.2),
request.http.server.port=63842,
request.http.client.host=127.0.0.1,
request.resourceClass=com.example.helloworld.resources.HelloWorldResource,
request.http.path.template=/hello-world,
request.http.server.name=localhost,
request.http.headers.Host=localhost:63842,
response.http.headers.Content-Type=application/json,
response.http.contentType=application/json,
response.http.entityType=com.example.helloworld.api.Saying,
response.http.status.code=200,
request.http.client.address=127.0.0.1,
request.resourceMethod=sayHello,
response.http.status.phrase=OK,
response.http.body={
"id" : 1,
"content" : "Hello, Dr. IntegrationTest!"
},
response.http.contentLength=59,
request.http.server.scheme=http,
response.http.status.status=OK,
response.http.status.family=SUCCESSFUL>
```
--------------------------------
### YAML Configuration with Environment Variable Substitution
Source: https://liftwizard.io/docs/configuration/environment-variable-substitution
Example of a YAML configuration file demonstrating environment variable substitution for the 'defaultName' property. The ${VAR:-DEFAULT} syntax provides a default value if the environment variable is not set.
```yaml
template: Hello, %s!
defaultName: ${DW_DEFAULT_NAME:-Stranger}
```
--------------------------------
### Set Default Maven Goal
Source: https://liftwizard.io/docs/maven/minimal-parent
Define the default goal to execute when running mvn without arguments, preferring verify over install.
```xml
verify
```
--------------------------------
### Example SQL Log with MDC Context
Source: https://liftwizard.io/docs/graphql/instrumentation-logging
This JSON represents a log entry for an SQL query executed within a GraphQL DataFetcher. It includes standard log fields along with custom fields prefixed with 'liftwizard.graphql' and 'liftwizard.p6spy', providing context about the GraphQL execution and the database operation.
```json
{
"@timestamp": "2020-11-26T21:03:23.010-05:00",
"@version": "1",
"message": "select t0.key,t0.title,t0.description_markdown,t0.imgur_image_id,t0.created_by_id,t0.created_on,t0.last_updated_by_id,t0.system_from,t0.system_to from BLUEPRINT t0 inner join FIREBASE_USER t1 on t0.created_by_id = t1.user_id where t1.system_to = '9999-12-01T18:59:00.000-0500' and substr(t1.display_name,1,9) = 'factorioi' and t0.system_to = '9999-12-01T18:59:00.000-0500'",
"logger_name": "io.liftwizard.logging.p6spy.P6SpySlf4jLogger",
"thread_name": "dw-35 - POST /graphql",
"level": "INFO",
"level_value": 20000,
"liftwizard.graphql.executionId": "18905eb7-2d87-42b9-ad14-90856949dc4e",
"liftwizard.graphql.field.path": "/blueprintByOperation",
"liftwizard.graphql.field.parentType": "Query",
"liftwizard.graphql.field.name": "blueprintByOperation",
"liftwizard.graphql.field.type": "Blueprint",
"liftwizard.p6spy.connectionId": 19,
"liftwizard.p6spy.now": "2020-11-27T02:03:23.010Z",
"liftwizard.p6spy.elapsed": 164,
"liftwizard.p6spy.category": "statement",
"liftwizard.p6spy.prepared": "select t0.key,t0.title,t0.description_markdown,t0.imgur_image_id,t0.created_by_id,t0.created_on,t0.last_updated_by_id,t0.system_from,t0.system_to from BLUEPRINT t0 inner join FIREBASE_USER t1 on t0.created_by_id = t1.user_id where t1.system_to = ? and substr(t1.display_name,1,9) = ? and t0.system_to = ?",
"liftwizard.p6spy.sql": "select t0.key,t0.title,t0.description_markdown,t0.imgur_image_id,t0.created_by_id,t0.created_on,t0.last_updated_by_id,t0.system_from,t0.system_to from BLUEPRINT t0 inner join FIREBASE_USER t1 on t0.created_by_id = t1.user_id where t1.system_to = '9999-12-01T18:59:00.000-0500' and substr(t1.display_name,1,9) = 'factorioi' and t0.system_to = '9999-12-01T18:59:00.000-0500'",
"liftwizard.p6spy.url": "jdbc:p6spy:h2:tcp://localhost:9096/liftwizard-app-h2;NON_KEYWORDS=USER;query_timeout=600000",
"caller_class_name": "io.liftwizard.logging.p6spy.P6SpySlf4jLogger",
"caller_method_name": "logSQL",
"caller_file_name": "P6SpySlf4jLogger.java",
"caller_line_number": 82
}
```
--------------------------------
### Temporal Blueprint Response
Source: https://liftwizard.io/docs/temporal-data/non-destructive-updates
Example of a JSON response containing temporal metadata fields for a blueprint resource.
```json
{
key: "6ed1f638-a63c-3a54-af67-ba494f27bff2",
1
systemFrom: "2001-01-03T23:59:59Z",
2
systemTo: null,
3
version: {
4
number: 1,
systemFrom: "2001-01-03T23:59:59Z",
systemTo: null,
createdOn: "2001-01-03T23:59:59Z",
5
createdBy: {
userId: "User ID",
},
lastUpdatedBy: {
userId: "User ID",
},
},
title: "Blueprint title",
voteSummary: {
numberOfUpvotes: 0,
systemFrom: "2001-01-03T23:59:59Z",
systemTo: null,
},
blueprintString: {
sha: "cc341849b4086ce7b1893b366b0dc8e99ce4e595",
6
createdOn: "2001-01-02T23:59:59Z",
7
createdBy: {
userId: "User ID",
},
},
imgurImage: {
imgurId: "Imgur ID 1",
8
imgurType: "image/png",
height: 300,
width: 300,
systemFrom: "2001-01-01T23:59:59Z",
9
systemTo: null,
},
descriptionMarkdown: "Blueprint description markdown",
tags: [
{
systemFrom: "2001-01-03T23:59:59Z",
10
systemTo: null,
tag: {
category: "belt",
11
name: "balancer",
ordinal: 1,
systemFrom: "2000-01-01T00:00:00Z",
12
systemTo: null,
},
},
],
}
```
--------------------------------
### Initialize JerseyHttpLoggingBundle with StructuredArgumentsMDCLogger
Source: https://liftwizard.io/docs/logging/JerseyHttpLoggingBundle
Add JerseyHttpLoggingBundle to your bootstrap initialization. This example uses StructuredArgumentsMDCLogger for logging with MDC context.
```java
@Override
public void initialize(Bootstrap bootstrap) {
bootstrap.setConfigurationFactoryFactory(new JsonConfigurationFactoryFactory<>());
bootstrap.addBundle(new EnvironmentConfigBundle());
bootstrap.addBundle(new ObjectMapperBundle());
bootstrap.addBundle(new ConfigLoggingBundle());
StructuredArgumentsMDCLogger structuredLogger = new StructuredArgumentsMDCLogger(bootstrap.getObjectMapper());
bootstrap.addBundle(new JerseyHttpLoggingBundle(structuredLogger));
// ...
}
```
--------------------------------
### Production Configuration for Firebase Authentication
Source: https://liftwizard.io/docs/auth/dynamic-authentication-and-impersonation
This JSON configuration example shows how to set up Firebase authentication for production environments. It includes the 'firebase' type filter and requires the `FIREBASE_CONFIG` environment variable.
```json
{
"authFilters": [
{
"type": "firebase",
"databaseUrl": "https://example.firebaseio.com",
"firebaseConfig": "${FIREBASE_CONFIG}"
}
]
}
```
--------------------------------
### Logback Configuration for Buffered Appender
Source: https://liftwizard.io/docs/logging/buffered-logging
Configure logback.xml to use BufferedAppender, delegating to a ConsoleAppender for output. This setup buffers logs until CLEAR or FLUSH markers are encountered.
```xml
%highlight(%-5level) %cyan(%date{HH:mm:ss.SSS, ${LOGGING_TIMEZONE}}) %gray(\(%file:%line\)) [%white(%thread)] %blue(%marker) {%magenta(%mdc)} %green(%logger): %message%n%rootException
```
--------------------------------
### Liquibase Configuration with Named Data Source
Source: https://liftwizard.io/docs/database/named-data-source
Example JSON5 configuration for Liquibase, specifying a data source named 'h2-tcp' for migrations. This demonstrates referencing a named data source by its name.
```json
{
"liquibase": {
"enabled": true,
"dataSourceMigrations": [
{
"dataSourceName": "h2-tcp",
"migrationFileName": "migrations.xml",
"migrationFileLocation": "classpath",
"contexts": []
}
],
"dryRun": false
}
}
```
--------------------------------
### Maven Enforcer Plugin Error Example
Source: https://liftwizard.io/docs/maven/minimal-parent
This error message from the maven-enforcer-plugin indicates that some plugins are missing valid versions and are relying on Maven defaults, which can lead to inconsistent build results.
```text
[ERROR] Rule 3: org.apache.maven.enforcer.rules.RequirePluginVersions failed with message:
Some plugins are missing valid versions or depend on Maven 3.9.5 defaults (LATEST, RELEASE as plugin version are not allowed)
org.apache.maven.plugins:maven-compiler-plugin. The version currently in use is 3.11.0 via default lifecycle bindings
org.apache.maven.plugins:maven-surefire-plugin. The version currently in use is 3.1.2 via default lifecycle bindings
org.apache.maven.plugins:maven-jar-plugin. The version currently in use is 3.3.0 via default lifecycle bindings
org.apache.maven.plugins:maven-clean-plugin. The version currently in use is 3.2.0 via default lifecycle bindings
org.apache.maven.plugins:maven-install-plugin. The version currently in use is 3.1.1 via default lifecycle bindings
org.apache.maven.plugins:maven-site-plugin. The version currently in use is 3.12.1 via default lifecycle bindings
org.apache.maven.plugins:maven-resources-plugin. The version currently in use is 3.3.1 via default lifecycle bindings
org.apache.maven.plugins:maven-deploy-plugin. The version currently in use is 3.1.1 via default lifecycle bindings
```
--------------------------------
### JUnit 5 LogMarkerTestExtension Example
Source: https://liftwizard.io/docs/logging/buffered-logging
Use LogMarkerTestExtension with JUnit 5 to automatically manage log buffering. It clears logs before tests and flushes them after failed tests by logging CLEAR and FLUSH markers.
```java
@ExtendWith(LogMarkerTestExtension.class)
public class ExampleTest
{
@Test
public void smokeTest()
{
// test code
}
}
```
--------------------------------
### Run Buildplan Maven Plugin Interactively
Source: https://liftwizard.io/docs/maven/minimal-parent
Execute the buildplan-maven-plugin to list plugins bound to each phase directly from the command line.
```bash
mvn org.codehaus.mojo:buildplan-maven-plugin:2.2.2:list
```
--------------------------------
### Run Spotless Apply and Java Formatting
Source: https://liftwizard.io/docs/maven/profile-parent
Use this command to format Java code and apply other specified configurations. Ensure the necessary profiles are activated.
```bash
mvn spotless:apply --activate-profiles spotless-apply,spotless-java,spotless-prettier-java-sort-imports
```
--------------------------------
### Liftwizard Application Initialization with EnvironmentConfigBundle
Source: https://liftwizard.io/docs/configuration/environment-variable-substitution
Illustrates how to add the EnvironmentConfigBundle to a Liftwizard application's bootstrap initialization.
```java
@Override
public void initialize(Bootstrap bootstrap) {
bootstrap.addBundle(new EnvironmentConfigBundle());
// ...
}
```
--------------------------------
### Run Buildplan Maven Plugin with POM Configuration
Source: https://liftwizard.io/docs/maven/minimal-parent
Execute the buildplan-maven-plugin using its shorthand syntax after configuring it in the pom.xml.
```bash
mvn buildplan:list
```
--------------------------------
### Dropwizard Application Initialization with Environment Variable Substitution
Source: https://liftwizard.io/docs/configuration/environment-variable-substitution
Shows how to configure Dropwizard's bootstrap to enable environment variable substitution using SubstitutingSourceProvider and EnvironmentVariableSubstitutor.
```java
@Override
public void initialize(Bootstrap bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
// ...
}
```
--------------------------------
### Configure Buildplan Maven Plugin
Source: https://liftwizard.io/docs/maven/minimal-parent
Configure the buildplan-maven-plugin in the pom.xml to specify tasks like 'clean' and 'deploy', and to show all phases.
```xml
org.codehaus.mojo
buildplan-maven-plugin
2.2.2
clean
deploy
true
```
--------------------------------
### POST /api/blueprint/
Source: https://liftwizard.io/docs/temporal-data/non-destructive-updates
Creates a new blueprint post by submitting title, blueprint string reference, image reference, description, and tags.
```APIDOC
## POST /api/blueprint/
### Description
Creates a new blueprint post. This is the final step in the blueprint creation process, linking previously created blueprint data and image data.
### Method
POST
### Endpoint
/api/blueprint/
### Request Body
- **title** (string) - Required - The title of the blueprint.
- **blueprintString** (object) - Required - Contains the sha foreign key to the blueprint data.
- **imgurImage** (object) - Required - Contains the imgurId foreign key to the image data.
- **descriptionMarkdown** (string) - Required - Markdown formatted description of the blueprint.
- **tags** (array) - Optional - List of tags associated with the blueprint.
### Request Example
{
"title": "Blueprint title",
"blueprintString": {
"sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595"
},
"imgurImage": {
"imgurId": "Imgur ID 1"
},
"descriptionMarkdown": "Blueprint description markdown",
"tags": [
{
"tag": {
"category": "belt",
"name": "balancer"
}
}
]
}
### Response
#### Success Response (200)
- **key** (string) - Unique identifier for the blueprint.
- **systemFrom** (string) - Timestamp of creation.
- **version** (object) - Versioning information.
- **voteSummary** (object) - Initial vote counts.
#### Response Example
{
"key": "6ed1f638-a63c-3a54-af67-ba494f27bff2",
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"version": {
"number": 1,
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"createdOn": "2001-01-03T23:59:59Z",
"createdBy": {
"userId": "User ID"
},
"lastUpdatedBy": {
"userId": "User ID"
}
},
"title": "Blueprint title",
"voteSummary": {
"numberOfUpvotes": 0,
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null
},
"blueprintString": {
"sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595",
"createdOn": "2001-01-02T23:59:59Z",
"createdBy": {
"userId": "User ID"
}
},
"imgurImage": {
"imgurId": "Imgur ID 1",
"imgurType": "image/png",
"height": 300,
"width": 300,
"systemFrom": "2001-01-01T23:59:59Z",
"systemTo": null
},
"descriptionMarkdown": "Blueprint description markdown",
"tags": [
{
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"tag": {
"category": "belt",
"name": "balancer",
"ordinal": 1,
"systemFrom": "2000-01-01T00:00:00Z",
"systemTo": null
}
}
]
}
```
--------------------------------
### Implement Configuration Getters and Setters
Source: https://liftwizard.io/docs/database/liquibase-migrations
Provide the necessary getter and setter methods for the Liquibase factory.
```java
@JsonProperty("liquibase")
@Override
public LiquibaseMigrationFactory getLiquibaseMigrationFactory() {
return this.liquibaseMigrationFactory;
}
@JsonProperty("liquibase")
public void setLiquibaseMigrationFactory(LiquibaseMigrationFactory liquibaseMigrationFactory) {
this.liquibaseMigrationFactory = liquibaseMigrationFactory;
}
```
--------------------------------
### Compiler Error Message Example
Source: https://liftwizard.io/docs/reladomo/reladomo-operation-compiler
Illustrates a helpful error message provided by the compiler when an invalid attribute name is used in the query string. It lists the valid attributes for the type.
```text
Could not find attribute 'invalidAttributeName' on type 'MyType' in this.invalidAttributeName = "Value". Valid attributes: [idProperty, stringProperty, integerProperty, longProperty, doubleProperty, floatProperty, booleanProperty, instantProperty, localDateProperty, createdById, createdOn, lastUpdatedById, systemFrom, systemTo]
```
--------------------------------
### Register Liquibase Migration Bundle
Source: https://liftwizard.io/docs/database/liquibase-migrations
Add the LiftwizardLiquibaseMigrationBundle to the application's initialize method.
```java
@Override
public void initialize(Bootstrap bootstrap)
{
// ...
bootstrap.addBundle(new LiftwizardLiquibaseMigrationBundle());
// ...
}
```
--------------------------------
### GitHub Actions: Spotless Java Check Job
Source: https://liftwizard.io/docs/maven/profile-parent
This job checks Java code formatting using Spotless with specific profiles. It runs on Ubuntu and uses `jdx/mise-action`.
```yaml
jobs:
spotless-java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- run: mvn spotless:check --activate-profiles spotless-check,spotless-java,spotless-prettier-java-sort-imports
```
--------------------------------
### Register LiftwizardGraphQLBundle in Dropwizard
Source: https://liftwizard.io/docs/graphql/bundle
Add the bundle to the application's initialize method to enable GraphQL support and configure wiring.
```java
@Override
public void initialize(Bootstrap bootstrap)
{
bootstrap.setConfigurationFactoryFactory(new JsonConfigurationFactoryFactory<>());
bootstrap.addBundle(new EnvironmentConfigBundle());
bootstrap.addBundle(new ObjectMapperBundle());
bootstrap.addBundle(new ConfigLoggingBundle());
bootstrap.addBundle(new JerseyHttpLoggingBundle());
bootstrap.addBundle(new LiftwizardGraphQLBundle<>(
builder ->
{
// Set up GraphQL wiring
// builder.scalar(...);
// builder.type(...);
}));
// ...
}
```
--------------------------------
### POST Blueprint Response Body
Source: https://liftwizard.io/docs/temporal-data/non-destructive-updates
The server response includes all sent properties plus generated information like 'key', 'systemFrom', and 'version' details.
```json
{
"key": "6ed1f638-a63c-3a54-af67-ba494f27bff2",
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"version": {
"number": 1,
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"createdOn": "2001-01-03T23:59:59Z",
"createdBy": {
"userId": "User ID"
},
"lastUpdatedBy": {
"userId": "User ID"
}
},
"title": "Blueprint title",
"voteSummary": {
"numberOfUpvotes": 0,
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null
},
"blueprintString": {
"sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595",
"createdOn": "2001-01-02T23:59:59Z",
"createdBy": {
"userId": "User ID"
}
},
"imgurImage": {
"imgurId": "Imgur ID 1",
"imgurType": "image/png",
"height": 300,
"width": 300,
"systemFrom": "2001-01-01T23:59:59Z",
"systemTo": null
},
"descriptionMarkdown": "Blueprint description markdown",
tags": [
{
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"tag": {
"category": "belt",
"name": "balancer",
"ordinal": 1,
"systemFrom": "2000-01-01T00:00:00Z",
"systemTo": null
}
}
]
}
```
--------------------------------
### Implement LiquibaseMigrationFactoryProvider
Source: https://liftwizard.io/docs/database/liquibase-migrations
Update the configuration class to implement the required interface.
```java
public class HelloWorldConfiguration
extends Configuration
implements LiquibaseMigrationFactoryProvider // , ... other interfaces
{
// ...
}
```
--------------------------------
### POST /api/blueprint
Source: https://liftwizard.io/docs/temporal-data/non-destructive-updates
Creates a new blueprint. The response includes detailed information about the created blueprint, including temporal data like systemFrom and systemTo.
```APIDOC
## POST /api/blueprint
### Description
Creates a new blueprint with the provided details. The response contains the full blueprint object, including server-generated fields and temporal information.
### Method
POST
### Endpoint
/api/blueprint
### Request Body
- **blueprintString** (object) - Required - The blueprint string object, typically containing a SHA hash.
- **imgurImage** (object) - Optional - The imgur image object, typically containing an ID.
- **title** (string) - Optional - The title of the blueprint.
- **descriptionMarkdown** (string) - Optional - The description of the blueprint in markdown format.
### Request Example
```json
{
"blueprintString": {
"sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595"
},
"imgurImage": {
"imgurId": "Imgur ID 1"
},
"title": "Blueprint title",
"descriptionMarkdown": "Blueprint description markdown"
}
```
### Response
#### Success Response (200)
- **key** (string) - The unique identifier for the blueprint.
- **systemFrom** (string) - The timestamp when the record became effective.
- **systemTo** (null) - Indicates the record is current.
- **version** (object) - Versioning information for the blueprint.
- **title** (string) - The title of the blueprint.
- **voteSummary** (object) - Summary of votes for the blueprint.
- **blueprintString** (object) - The blueprint string details.
- **imgurImage** (object) - The imgur image details.
- **descriptionMarkdown** (string) - The description of the blueprint in markdown format.
- **tags** (array) - An array of tags associated with the blueprint.
#### Response Example
```json
{
"key": "6ed1f638-a63c-3a54-af67-ba494f27bff2",
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"version": {
"number": 1,
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"createdOn": "2001-01-03T23:59:59Z",
"createdBy": {
"userId": "User ID"
},
"lastUpdatedBy": {
"userId": "User ID"
}
},
"title": "Blueprint title",
"voteSummary": {
"numberOfUpvotes": 0,
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null
},
"blueprintString": {
"sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595",
"createdOn": "2001-01-02T23:59:59Z",
"createdBy": {
"userId": "User ID"
}
},
"imgurImage": {
"imgurId": "Imgur ID 1",
"imgurType": "image/png",
"height": 300,
"width": 300,
"systemFrom": "2001-01-01T23:59:59Z",
"systemTo": null
},
"descriptionMarkdown": "Blueprint description markdown",
"tags": [
{
"systemFrom": "2001-01-03T23:59:59Z",
"systemTo": null,
"tag": {
"category": "belt",
"name": "balancer",
"ordinal": 1,
"systemFrom": "2000-01-01T00:00:00Z",
"systemTo": null
}
}
]
}
```
```
--------------------------------
### Query Blueprint Version in SQL
Source: https://liftwizard.io/docs/temporal-data/versioning
Retrieves a specific version record from the blueprint version table.
```sql
select *
from BLUEPRINT_VERSION t0
where t0.key = '6ed1f638-a63c-3a54-af67-ba494f27bff2'
and t0.number = 1
```
--------------------------------
### JSON5 Configuration for Console Logging
Source: https://liftwizard.io/docs/logging/JerseyHttpLoggingBundle
Configure console logging in JSON5 format, including log format with MDC and markers, and caller data.
```json5
{
type: "console",
timeZone: "${LOGGING_TIMEZONE:-system}",
logFormat: "%highlight(%-5level) %cyan(%date{HH:mm:ss.SSS, %dwTimeZone}) %gray(\(%file:%line\)) [%white(%thread)] %blue(%marker) {%magenta(%mdc)} %green(%logger): %message%n%rootException",
includeCallerData: true,
}
```
--------------------------------
### Create Dropwizard ExecutorService
Source: https://liftwizard.io/docs/graphql/data-fetcher-async
Initializes an ExecutorService managed by the Dropwizard environment lifecycle.
```java
ExecutorService executorService = environment
.lifecycle()
.executorService("my-data-fetcher-%d")
.maxThreads(maxThreads)
.build();
```
--------------------------------
### Configure GraphQL Metrics Instrumentation
Source: https://liftwizard.io/docs/graphql/instrumentation-metrics
Add LiftwizardGraphQLMetricsInstrumentation to your GraphQLFactory to register performance metrics. This can be done by including the entire LiftwizardGraphQLBundle or by manually adding the instrumentation.
```java
GraphQLFactory factory = ...;
Clock clock = Clock.systemUTC();
var metricsInstrumentation = new LiftwizardGraphQLMetricsInstrumentation(this.metricRegistry, clock);
var loggingInstrumentation = new LiftwizardGraphQLLoggingInstrumentation();
List instrumentations = List.of(metricsInstrumentation, loggingInstrumentation);
factory.setInstrumentations(instrumentations);
```
--------------------------------
### Configure Resource Encodings
Source: https://liftwizard.io/docs/maven/minimal-parent
Specify UTF-8 encoding for resources and reporting to avoid platform-dependent build warnings.
```xml
UTF-8
UTF-8
```
--------------------------------
### Enable Reproducible Builds
Source: https://liftwizard.io/docs/maven/minimal-parent
Lock down the outputTimestamp property to ensure bit-by-bit identical build artifacts.
```xml
2026-03-03T17:31:36Z
```
--------------------------------
### Configure Maven Dependency Plugin
Source: https://liftwizard.io/docs/maven/minimal-parent
Include the maven-dependency-plugin in the pom.xml. No specific configuration is shown, implying default behavior.
```xml
org.apache.maven.plugins
maven-dependency-plugin
3.10.0
```
--------------------------------
### Configure Maven Compiler Plugin with Parameters
Source: https://liftwizard.io/docs/maven/minimal-parent
Set the version for the maven-compiler-plugin and enable parameter metadata generation for reflection. This configuration is for the 'compile' lifecycle phase.
```xml
org.apache.maven.plugins
maven-compiler-plugin
3.15.0
true
```
--------------------------------
### Inherit from liftwizard-minimal-parent
Source: https://liftwizard.io/docs/maven/minimal-parent
Add this parent configuration to your project's pom.xml to inherit standard best practices.
```xml
io.liftwizard
liftwizard-minimal-parent
${liftwizard.version}
```
--------------------------------
### Set Liftwizard Profile Parent as Project Parent
Source: https://liftwizard.io/docs/maven/profile-parent
Inherit from `liftwizard-profile-parent` to gain pre-configured Maven profiles for code quality and CI.
```xml
io.liftwizard
liftwizard-profile-parent
${liftwizard.version}
```
--------------------------------
### Add LiftwizardGraphQLLoggingInstrumentation to GraphQLFactory
Source: https://liftwizard.io/docs/graphql/instrumentation-logging
To enable logging instrumentation, add LiftwizardGraphQLLoggingInstrumentation to your GraphQLFactory's list of instrumentations. This requires importing the necessary classes.
```java
GraphQLFactory factory = ...;
var loggingInstrumentation = new LiftwizardGraphQLLoggingInstrumentation();
List instrumentations = List.of(loggingInstrumentation);
factory.setInstrumentations(instrumentations);
```
--------------------------------
### Flexible Number Literals
Source: https://liftwizard.io/docs/reladomo/reladomo-operation-compiler
Demonstrates various ways to define float, double, and integer literals, including the use of underscores for readability.
```Scala
this.floatProperty = 42.0f
```
```Scala
this.floatProperty = 42.0d
```
```Scala
this.floatProperty = 42
```
```Scala
this.doubleProperty = 42.0f
```
```Scala
this.doubleProperty = 42.0d
```
```Scala
this.doubleProperty = 42
```
```Scala
this.longProperty = 10_000_000_000
```
```Scala
this.integerProperty = 1_000_000_000
```
--------------------------------
### Configure JSON5 Factory in Dropwizard
Source: https://liftwizard.io/docs/configuration/json5-configuration
Override the initialize method in your Application class to set the configuration factory to JSON5.
```java
@Override
public void initialize(Bootstrap bootstrap) {
bootstrap.setConfigurationFactoryFactory(new JsonConfigurationFactoryFactory<>());
// ...
}
```
--------------------------------
### Run Static Analysis with Error Prone
Source: https://liftwizard.io/docs/maven/profile-parent
Execute static analysis using Error Prone with strict settings. This command is typically run during the verify phase.
```bash
mvn verify --activate-profiles errorprone-strict
```
--------------------------------
### Add JSON5 Configuration Dependency
Source: https://liftwizard.io/docs/configuration/json5-configuration
Include the liftwizard-configuration-factory-json module in your Maven project.
```xml
io.liftwizard
liftwizard-configuration-factory-json
```
--------------------------------
### Configure Maven Wrapper Plugin
Source: https://liftwizard.io/docs/maven/minimal-parent
Configure the maven-wrapper-plugin to specify the Maven version for the wrapper.
```xml
maven-wrapper-plugin
3.3.4
```
--------------------------------
### Configure Maven Deploy Plugin
Source: https://liftwizard.io/docs/maven/minimal-parent
Defines the version for the Maven deploy plugin used during the deployment phase.
```xml
org.apache.maven.plugins
maven-deploy-plugin
3.1.4
```
--------------------------------
### Add Liftwizard GraphQL Metrics Dependency
Source: https://liftwizard.io/docs/graphql/instrumentation-metrics
Include the liftwizard-graphql-instrumentation-metrics module in your project's dependencies to use the GraphQL metrics instrumentation.
```xml
io.liftwizard
liftwizard-graphql-instrumentation-metrics
```
--------------------------------
### Add Maven Dependency
Source: https://liftwizard.io/docs/graphql/data-fetcher-async
Includes the liftwizard-graphql-data-fetcher-async module in the project dependencies.
```xml
io.liftwizard
liftwizard-graphql-data-fetcher-async
```