The current code foe each event loads its schema in this way
|
public String eventSchema() { |
|
try { |
|
return Files.readString(Paths.get(CDEventConstants.SCHEMA_FOLDER + "/pipelinerunstarted.json")); |
|
} catch (IOException e) { |
|
throw new CDEventsException("Exception while reading Event JsonSchema file ", e); |
|
} |
|
} |
Which means it expects to find the schema as a file in the filesystem. This code fails when the cdevents-java-sdk is consumed as a dependency by other projects, as the schema files are no longer found in the filesystem but rather as embedded resources within the cdevents-java-sdk JAR.
This code must be updated to find the schema as a classpath resource first, falling back to filesystem if not found.
The current code foe each event loads its schema in this way
sdk-java/sdk/src/main/java/dev/cdevents/events/PipelinerunStartedCDEvent.java
Lines 102 to 108 in 3055c23
Which means it expects to find the schema as a file in the filesystem. This code fails when the
cdevents-java-sdkis consumed as a dependency by other projects, as the schema files are no longer found in the filesystem but rather as embedded resources within thecdevents-java-sdkJAR.This code must be updated to find the schema as a classpath resource first, falling back to filesystem if not found.