Skip to content

PART 2: Generate events using jsonschema2pojo and mustache template #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Nov 30, 2023

Conversation

rjalander
Copy link
Contributor

Continuation of the PR #58 to generate all other events using the mustache template,
Generating all events from schema repo

Jalander Ramagiri and others added 30 commits June 26, 2023 13:54
Co-authored-by: Lapenta Francesco Davide <37077655+lapentad@users.noreply.github.com>
Co-authored-by: Lapenta Francesco Davide <37077655+lapentad@users.noreply.github.com>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Co-authored-by: Lapenta Francesco Davide <37077655+lapentad@users.noreply.github.com>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Co-authored-by: Lapenta Francesco Davide <37077655+lapentad@users.noreply.github.com>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Jalander Ramagiri and others added 12 commits July 13, 2023 11:16
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

update CDEventsGenerator file

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

update CDEventsGenerator file

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

Update phase for CDEventsGenerator main class

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

adding missing file to repo

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

Update src/main/java/dev/cdevents/CDEventsGenerator.java

Co-authored-by: Lapenta Francesco Davide <37077655+lapentad@users.noreply.github.com>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

Update src/main/java/dev/cdevents/CDEventsGenerator.java

Co-authored-by: Lapenta Francesco Davide <37077655+lapentad@users.noreply.github.com>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

update with review comments and some linter issues

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

fix linter issues

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

updating linter.yml

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

fix linter issues with MagicNumber

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

fix linter issues with MagicNumber

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

lint exclude list in array path

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

update FILTER_REGEX_EXCLUDE pattern

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

update MaginNumners with constants

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

ignoreFieldDeclaration for MagicNumber check-style

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

cleanup existing/manual events to keep only gererated events

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

Refacoring the code to use maven submodules for generator and sdk

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

fix minor lint issue

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>

updating release files as per comment

Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
Signed-off-by: Jalander Ramagiri <jalander.ramagiri@est.tech>
@rjalander
Copy link
Contributor Author

@afrittoli can you please review theses changes when you get some time. Thank you.

@rjalander rjalander self-assigned this Oct 19, 2023
@@ -84,10 +85,12 @@
</goals>
<configuration>
<sourcePaths>
<sourcePath>${sdk.project.dir}/src/main/resources/schema/artifact-packaged-event.json
</sourcePath>
<sourcePath>${parent.project.dir}/spec/schemas/artifactpackaged.json</sourcePath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only slight issue I see with this approach is that new events will have to be added manually to this config.
It actually may be a positive thing to have a static configuration, but perhaps we should have some kind of check in place that verifies that a class has been generated for every schema available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will create a separate issue to verify the number of generated files from schemas with unit testing.

</sourcePaths>
<outputDirectory>${sdk.project.dir}/src/main/java</outputDirectory>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit long to properly review manually, did you generate it with a script, or do you have a script to verify its correctness?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is created manually, but I can add a test to verify the number of generated files from schemas

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, pointing to v0.1.2 for now! +1

Comment on lines +71 to +75
} else {
log.error("No schema files found in the specified directory {}", folder.getAbsolutePath());
}
} else {
log.error("No schema directory found in the specified directory {}", folder.getAbsolutePath());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For automation purposes, it would be nice if the tool accumulated the various errors and failed at the end, rather than only logging errors.

Copy link
Contributor

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rjalander - I left a couple of comments, but nothing blocking - perhaps we can iterate on this in another PR.
I did not review the pom.xml in details, let me know if you need to me to do that or if you have some script to verify it.

Could you squash the commits into a few ones (or one) before merging please?

@cdevents-bot
Copy link
Collaborator

🎉 This issue has been resolved in v0.3.0 (Release Notes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest released Issue has been released
Projects
Development

Successfully merging this pull request may close these issues.

3 participants