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
Support opting out of various numeric base literal interpretation #276
Comments
There is no way to change the behavior at this point, but a PR for adding a new option ( One quick question since I do not remember exact behavior pre-2.12: were these values reported as |
Thanks. Numbers in YAML were being parsed into IntNodes. I won’t have time to contribute this feature myself though. |
On closer look, it seems like our tool that deploys K8s manifests to clusters can use the decimal or octal notation. So we should be able to upgrade this library without any issues. I'm going to leave this issue open for others who may need it. But the need is less for me now.
— https://kubernetes.io/docs/concepts/configuration/secret/#secret-files-permissions |
Correct wrt JSON/YAML -- decimal integer values must not start with I was curious wrt |
My K8s YAML is below.
The code is YamlMapper = new YamlMapper();
final TypeReference<ObjectNode> objNodeRef = new TypeReference<ObjectNode>() {};
public static List<ObjectNode> read(final String content) throws IOException {
YamlMapper
.readValues(YAML_FACTORY.createParser(content), objNodeRef)
.readAll()
.stream()
.map(rawYaml -> (ObjectNode) rawYaml)
.collect(Collectors.toList());
}
final List<ObjectNode> provided = Yaml.read(fixture("path/to/yaml-above.yaml")) Then |
Is there a way to disable the various numeric base literal support added by this commit? We have K8s YAML like the below.
Version < 2.12.0 parsed
defaultMode
into an IntNode with value444
. Versions >= 2.12.0 parse into an IntNode with decimal value 292 (0444 is 292 in octal). We're using this library in an internal tool in a large company. A quick code search yields ~2K instances of justdefaultMode: 0444
.If there isn't a way to disable this behavior, perhaps consider this a feature request or bug fix (depends on if you view this minor semantic version change as accidentally including a breaking change) to support a config knob to opt out of this behavior?
The text was updated successfully, but these errors were encountered: