private String removeTrailingNewline(String str) {
        if (str.endsWith("\n")) {
            return str.substring(0, str.length() - 1);
        }
        return str;
    }
Writes the schema file by replacing template placeholders with definitions of detected fields.

@param detectedFields The fields detected in the input data
@throws IOException if an error occurs while writing the schema file
integration/logstash-plugins/logstash-output-vespa/src/main/java/org/logstashplugins/VespaAppPackageWriter.java