-
Notifications
You must be signed in to change notification settings - Fork 101
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
feat: export notice schema as json file #925
Conversation
…ild files (remove jackson dependencies)
@barbeau following our discussion of Thursday: this could probably be written in a more modular way (to consider |
# Conflicts: # core/src/main/java/org/mobilitydata/gtfsvalidator/notice/CsvParsingFailedNotice.java
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainer.java
Outdated
Show resolved
Hide resolved
@maximearmstrong PTAL, I modified the implementation regarding the suggestions you made during our last discussion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lionel-nj - some preliminary feedback is below. I ran into some other issues while reviewing that I opened other issues for, so I ran out of time before I could do a full review. I'd like to look at this more, but here's my thoughts so far.
core/src/main/java/org/mobilitydata/gtfsvalidator/annotation/SchemaExport.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainer.java
Outdated
Show resolved
Hide resolved
I am considering to give up the
We need to estimate what are the costs of the proposed alternative.
|
Indeed, that would overall simplify the documentation tasks and the work within this PR.
Do you have documentation that you suggest reading, or would this be an empirical measurement? |
I tried https://github.com/stokito/IdeaJol and it nicely shows the actual consumption. tl;dr Fields consume less memory than Maps. The current "Map" approach uses two fields in the
The map is an instance of
So, we have at least 48 bytes per each field and also a fixed 44 bytes overhead for the Let's compare memory consumption for small and large notice classes. We do not take
Note that map also keeps key names as a separate string objects that also consume space. If we switch to fields, we won't consume them. |
Have I convinced you that we need fields? :) |
@barbeau @lionel-nj @maximearmstrong If you agree that we should use fields instead of map, then I am proposing the following plan. Pull request 1. Convert all notice classes to fields instead of maps. I will do that. |
Thanks for the explanation and the reference to the IntelliJ plugin : will definitely reuse that in the future👀
That looks like a good idea to me!
👍🏾 |
# Conflicts: # core/src/main/java/org/mobilitydata/gtfsvalidator/notice/Notice.java # core/src/test/java/org/mobilitydata/gtfsvalidator/notice/StringFieldNotice.java
It looks like this PR is still using constructor parameters. Unfortunately, this won't work with all notice classes. Please let me prepare my code that uses reflections. |
Please see my #951 |
Thanks for review of my PR! Now you can sync your code and plug the committed NoticeSchemaGenerator into Main.java. |
# Conflicts: # core/src/main/java/org/mobilitydata/gtfsvalidator/notice/Notice.java # core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeSchemaGenerator.java # core/src/test/java/org/mobilitydata/gtfsvalidator/notice/NoticeSchemaGeneratorTest.java # main/build.gradle # main/src/main/java/org/mobilitydata/gtfsvalidator/cli/Main.java
Thanks for #951 @aababilov - integrated the changes provided to this PR, does that seem alright to you? @maximearmstrong @barbeau |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Very nice.
main/src/main/java/org/mobilitydata/gtfsvalidator/cli/Main.java
Outdated
Show resolved
Hide resolved
This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: |
closes #899
Summary:
This PR provides support to export notice schema as a json file.
Expected behavior:
When providing the additional CLI parameter
-n
--export_notices_schema
: a json file namednotice_schema.json
should be created and stored in the folder specified by theoutput_base
CLI parameter).See gist linked https://gist.github.com/lionel-nj/be94d4cb18af68e743408c5c6c5129ab.
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle test
to make sure you didn't break anything[] Include screenshot(s) showing how this pull request works and fixes the issue(s)