Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since we still want Java POJOs to represent all entities, we will use the schema-to-pojo-maven-plugin to build these POJOs. This is done by simply added the following to the lib-auto-generated/pom.xml file:

Code Block
		<!-- This plugin builds the POJOs from JSON schemas. -->
		<plugins>
			<plugin>
				<groupId>org.sagebionetworks</groupId>
				<artifactId>schema-to-pojo-maven-plugin</artifactId>
				<version>${schema-to-pojo.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<sourceDirectory>src/main/resources</sourceDirectory>
							<packageName>org.sagebionetworks</packageName>
							<outputDirectory>target/auto-generated-pojos</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>

...

Folder entities will be created as need to create each path. By giving each SchemaEntity a unique path, we can use this path to reference a schema before we have an entity to represent it.

The API user will be able to get the SchemaEntity objects but they will be READ-ONLY copies. This is important, because the "truth" of each entity is the JSON text file from the auto-generated-pojos project. Hopefully, this will make more sense as the rest of the life-cycle is outlined.

Edit of an Schema

Imagine that we want to add a new primary field to our Example.json Entity. To do this we need to modify the original JSON file in the lib-auto-generated

...