Skip to content

Commit

Permalink
validate RunLink and JobLink
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
  • Loading branch information
pawel-big-lebowski committed Jan 3, 2023
1 parent ae6250a commit 83f9bf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/src/main/java/marquez/service/models/LineageEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public NominalTimeRunFacet(
@ToString
public static class ParentRunFacet extends BaseFacet {

@NotNull private RunLink run;
@NotNull private JobLink job;
@Valid @NotNull private RunLink run;
@Valid @NotNull private JobLink job;

@Builder
public ParentRunFacet(
Expand Down
7 changes: 7 additions & 0 deletions api/src/test/java/marquez/OpenLineageIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ public void testSendOpenLineageBadArgument() throws IOException {
"{\"eventTime\": \"2021-11-03T10:53:52.427343\", \"eventType\": \"COMPLETE\", \"inputs\": [{\"facets\": {}, \"name\": \"OPEN_LINEAGE_DEMO.DEMO.SOURCE_TABLE_1\", \"namespace\": \"testing_namespace_1\"}], "
+ "\"job\": {\"facets\": {}, \"name\": \"testing_name_1\", \"namespace\": \"testing_namespace_1\"}, "
+ "\"outputs\": [], \"producer\": \"me\", \"run\": {\"facets\": {}, \"runId\": null}}",

// parent run facet has an empty {} run section
"{\"eventTime\": \"2021-11-03T10:53:52.427343\", \"eventType\": \"COMPLETE\", \"inputs\": [{\"facets\": {}, \"name\": \"OPEN_LINEAGE_DEMO.DEMO.SOURCE_TABLE_1\", \"namespace\": \"testing_namespace_1\"}], "
+ "\"job\": {\"facets\": {}, \"name\": \"testing_name_1\", \"namespace\": \"testing_namespace_1\"}, "
+ "\"outputs\": [], \"producer\": \"me\", \"run\": {\"facets\": { \"parent\": "
+ "{ \"_producer\": \"me\", \"_schemaURL\": \"https://me\", \"run\": {}, \"job\": { \"namespace\": \"my-scheduler-namespace\", \"name\": \"myjob.mytask\"} }},"
+ "\"runId\": \"dae0d60a-6010-4c37-980e-c5270f5a6be4\"}}",
})
public void testSendOpenLineageEventFailsValidation(String eventBody) throws IOException {
final CompletableFuture<Integer> resp =
Expand Down

0 comments on commit 83f9bf5

Please sign in to comment.