@Override
    protected void constructMapping2ndStep(MappingNode node, final Map mapping) {
        ((Mapping) mapping).setSource(getSource(node));
        super.constructMapping2ndStep(node, new AbstractMapDecorator(mapping) {
            @Override
            public Object put(Object key, Object value) {
                if (!(key instanceof Scalar)) {
                    throw new IllegalStateException("We only support scalar map keys");
                }
                Object scalar = ObjectUtils.clone(value);
                if (scalar instanceof Number) {
                    scalar = new Scalar(scalar.toString());
                } else if (scalar instanceof Boolean) {
                    scalar = new Scalar(scalar.toString());
                }

                return mapping.put(key.toString(), scalar);
            }
        });
    }
Enforce Map keys are only Scalars and can be used as {@link String} keys in {@link Mapping}
plugin/src/main/java/io/jenkins/plugins/casc/yaml/ModelConstructor.java