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

965 schemas for inreach cmd populate schema folder #1141

Conversation

kunwarj
Copy link
Collaborator

@kunwarj kunwarj commented Mar 15, 2023

This fix helps to pass --add-schema flag to create schema for inReach forms with schemas-for-inreach command.
If the flag is not passed it asks the user if they want to create a schema or not. create schema if users answers "yes", else just print out the JSON definition.

@alexgao1
Copy link
Contributor

Closes #964, #965

alexgao1
alexgao1 previously approved these changes Mar 16, 2023
// Write JSON to file
File file = new File(schemaDir, "definition.json");
try {
FileOutputStream fos = new FileOutputStream(file);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need the flush statements (close flushes, and these aren't buffered writers anyway).
Can we switch this all over the try-with-resource pattern? That was introduced to make the closing of streams better/cleaner and handle exceptions better. This stack overflow shows multiple stream try-with-resource https://stackoverflow.com/questions/41248572/sonar-how-to-use-try-with-resources-to-close-fileoutputstream

Copy link
Collaborator

Choose a reason for hiding this comment

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

…hemas-for-inreach-cmd-populate-schema-folder
@billingb billingb merged commit e2d5b0f into GCRC:master Mar 17, 2023
@kunwarj kunwarj deleted the 965-schemas-for-inreach-cmd-populate-schema-folder branch October 22, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants