Skip to content

Fix json encoding #185

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 1 commit into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ protected BuildContext getBuildContext()
protected Writer newWriter( Path path )
{
Charset charset = getEncoding() != null ? Charset.forName( getEncoding() ) : Charset.defaultCharset();
return newWriter( path, charset );
}

protected Writer newWriter( Path path, Charset charset )
{
return new CachingWriter( getBuildContext(), path, charset );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
Expand Down Expand Up @@ -107,7 +108,7 @@ private void generateJsonSchema( Properties parameters )
.enable( JsonWriteFeature.QUOTE_FIELD_NAMES.mappedFeature() )
.enable( JsonWriteFeature.QUOTE_FIELD_NAMES.mappedFeature() )
.disable( JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS.mappedFeature() )
.createGenerator( newWriter( schemaFile.toPath() ) );
.createGenerator( newWriter( schemaFile.toPath(), StandardCharsets.UTF_8 ) );

generator.useDefaultPrettyPrinter();

Expand Down