Skip to content

Make FastJsonHttpLogFormatter honor the JsonMapper's ObjectWriteContext - #2390

Open
nhmarujo wants to merge 3 commits into
zalando:mainfrom
nhmarujo:2389-json-write-pojo
Open

Make FastJsonHttpLogFormatter honor the JsonMapper's ObjectWriteContext#2390
nhmarujo wants to merge 3 commits into
zalando:mainfrom
nhmarujo:2389-json-write-pojo

Conversation

@nhmarujo

@nhmarujo nhmarujo commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #2389

Comment on lines -54 to 62
public FastJsonHttpLogFormatter(final JsonFactory factory, final JsonFieldWriter delegate) {
this(factory, delegate, false);
}

public FastJsonHttpLogFormatter(final JsonFactory factory, final JsonFieldWriter delegate, final boolean validateJsonBody) {
this.factory = factory;
this.delegate = delegate;
this.validateJsonBody = validateJsonBody;
this.jsonMapper = mapper;
this.delegate = writer;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a way to still preserve the constructors that use JsonFactory for those who'd prefer to use it? I'm trying to think if a breaking change here is necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. I added a commit to reinstate the constructor that takes a JsonFactory.

I didn't add back the constructor with signature public FastJsonHttpLogFormatter(final JsonFactory factory, final JsonFieldWriter delegate, final boolean validateJsonBody) though, as I don't think it made sense even before. validateJsonBody was necessary purely to create DefaultJsonFieldWriter and didn't have any use in this particular constructor.

Please let me know your thoughts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kasmarian any thougths?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fixes and patches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FastJsonHttpLogFormatter creates an empty ObjectWriteContext instead of inheriting from JsonMapper

3 participants