Skip to content

Conversation

@maciej-kisiel
Copy link
Contributor

It's causing some servers to fail: #767. I checked with Typescript implementation and it doesn't do any escaping.

It's still a behavior change.

@jba
Copy link
Contributor

jba commented Jan 29, 2026

We should provide a way to preserve the old behavior. We don't know who depends on it.
See #238.
For example code, see https://github.com/google/jsonschema-go/blob/main/jsonschema/infer.go#L138.

func EncodeIndent(msg Message, prefix, indent string) ([]byte, error) {
wire := wireCombined{VersionTag: wireVersion}
msg.marshal(&wire)
// TODO: do we need to escape HTML here?
Copy link
Contributor

Choose a reason for hiding this comment

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

It's only used in tests, but why should tests behave differently? So you should turn off escaping here too.

return nil, nil
}
data, err := json.Marshal(obj)
data, err := jsonMarshal(obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you grep the codebase, there are many other calls to json.Marshal. Should they all go to jsonMarshal? I'm not sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

If this is specifically about messages, this is probably the only location that needs to change.

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.

4 participants