Skip to content
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

JsonSchema generated classes are persisted #3079

Merged
merged 5 commits into from
May 12, 2021

Conversation

manusa
Copy link
Member

@manusa manusa commented May 4, 2021

Description

Partially persist generated model in src/generated/java/.

This PR contains:

  • Changed pom.xml:
    • Modified to allow an extra source directory
    • Configured additional execution to generate JsonSchema classes into that directory
  • Modified generation scripts to include Maven build step to generate Java classes in addition to json schemas.

When reviewing you should consider the changed poms, shell scripts and CI workflow configurations (basically ignore any *.java file).

Relates to #2118 and #2119

What does this PR bring?

  • 👍 Lowered the compilation time (without tests) from ~7 to ~6 minutes ---> ~15%
  • 👍 Should improve IDE experience, running a test from the IDE should now be possible and hassle free (still not perfect, but a considerable improvement should be noted)
  • 👎 Model generation ./kubernetes-model-generator/generateModelDocker.sh takes much longer since it involves a Maven execution for each module. This shouldn't really be a problem because it has only to be executed in case there are changes in our go files.
  • 👎 + 👍 Similar to the previous point, the CI workflow "Go Build / Kubernetes Model Generator Build " takes longer to execute. Since this happens in the CI, it shouldn't be a problem either. On the other hand, we are now also verifying that generated Java classes won't change, which will allow us to detect early any trouble with the jsonschema2pojo code generation.

Feedback

So far my IDE experience with the partially persisted model has improved.
It would be nice if those of you who had previous issues with the setup (@metacosm. @Fabian-K, @jorsol...) could provide your feedback to see if we should proceed and merge this or consider it a failed experiment.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@centos-ci
Copy link

Can one of the admins verify this patch?

@manusa manusa added the wip label May 4, 2021
@manusa manusa force-pushed the feat/persisted-model branch from db9403c to 2f6df91 Compare May 4, 2021 17:17
@manusa manusa force-pushed the feat/persisted-model branch from 2f6df91 to 03c5e55 Compare May 4, 2021 17:42
@manusa manusa force-pushed the feat/persisted-model branch from 03c5e55 to a587989 Compare May 4, 2021 18:20
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 4, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication


DOCKER_IMAGE_GOLANG=golang:1.15.6
DOCKER_IMAGE_GOLANG=marcnuri/golang-1.15-java11
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oooh, that looks like a maintenance nightmare!

Copy link
Member Author

Choose a reason for hiding this comment

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

:)

https://github.com/manusa/docker-images/blob/2dab5af4baef3616cc7ad02ba7c8d27addb32aa9/golang-1.15-java11/Dockerfile#L8

Not really, it's a very simple image, but I haven't found any other, open, publicly maintained equivalent (I bet not many Golang developers want to mix it with Java, and vice-versa)

@manusa manusa marked this pull request as ready for review May 6, 2021 11:48
@manusa manusa changed the title WIP: JsonSchema generated classes are persisted JsonSchema generated classes are persisted May 6, 2021
@manusa manusa requested review from metacosm, rohanKanojia and oscerd May 6, 2021 11:49
@manusa manusa removed the wip label May 6, 2021
@rohanKanojia rohanKanojia requested a review from iocanel May 6, 2021 11:54
Copy link
Member

@rohanKanojia rohanKanojia left a comment

Choose a reason for hiding this comment

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

+1, I think it's a step forward to making the development experience better.

@Fabian-K
Copy link
Contributor

Looking good! What are the plans for /extensions? I assume it makes sense to apply this there as well :)

@manusa
Copy link
Member Author

manusa commented May 10, 2021

Looking good! What are the plans for /extensions? I assume it makes sense to apply this there as well :)

:) Yes, indeed. I'm just trying to make sure that we are on the right path before investing more time.

BTW, thx for the feedback ;)

@manusa manusa merged commit 26997d7 into fabric8io:master May 12, 2021
@manusa manusa deleted the feat/persisted-model branch May 12, 2021 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants