Giter Club home page Giter Club logo

xtrasonnet's People

Contributors

artnaseef avatar dependabot[bot] avatar fugu13 avatar jakemhughes avatar jam01 avatar kentbrownalpha avatar rlratcliffe avatar sinaiyuc avatar snyk-bot avatar znanatej avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mrsnappervibes

xtrasonnet's Issues

Camel: InputStreamCache should be a supported input for application/json

I get the following error with an InputStreamCache whose contents are JSON.

The input MediaType application/json is not supported for class org.apache.camel.converter.stream.InputStreamCache

InputStreamCache is just a sublcass of InputStream.

Workaround is to convert the message body to a String

.convertBodyTo(String.class)

Output CSV

Is it possible to write CSV? The closest I've gotten is outputting CSV string wrapped in an object.

release

  • unimplemented functions
  • header continue params
  • move param utils from default csv plugin
  • make qnamechar qnamesep...?
  • omit xml declaration in exclude?
  • docs funcs format
  • header changes
  • resource convenience?
  • null instance?
  • objectFrom?

The output MediaType application/json is not supported for class java.lang.String

Hi, I'm hoping you can help me understand what I'm doing wrong here:

var transform = """
            {
                name_title: payload.Salutation,
                name_first: payload.FirstName,
                name_last: payload.LastName,
                primary_email: payload.Email
            }
            """;
final Transformer transformer = Transformer.builder(transform)
        .configurePlugins(plugins -> {
            plugins.removeIf(plugin -> plugin instanceof DefaultJavaPlugin);
            plugins.add(0, new DefaultJavaPlugin(jsonMapper));
        })
        .build();

// contact is a POJO
final String result = transformer.transform(Document.of(contact, MediaTypes.APPLICATION_JAVA)).getContent();
Caused by: java.lang.IllegalArgumentException: The output MediaType application/json is not supported for class java.lang.String
	at io.github.jam01.xtrasonnet.DataFormatService.lambda$mandatoryWrite$0(DataFormatService.java:62)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at io.github.jam01.xtrasonnet.DataFormatService.mandatoryWrite(DataFormatService.java:62)
	at io.github.jam01.xtrasonnet.Transformer.$anonfun$transform$2(Transformer.scala:244)
	at io.github.jam01.xtrasonnet.Transformer$.io$github$jam01$xtrasonnet$Transformer$$handleException(Transformer.scala:36)
	at io.github.jam01.xtrasonnet.Transformer.transform(Transformer.scala:244)
	at io.github.jam01.xtrasonnet.Transformer.transform(Transformer.scala:210)

I've also tried with this, but it doesn't seem to help:

final String result = transformer.transform(
        Document.of(contact, MediaTypes.APPLICATION_JAVA),
        new HashMap<>(),
        MediaTypes.APPLICATION_JSON).getContent();

Thanks!

support streaming

I'm having a little trouble determining what syntax to use for transforming CSV files of undetermined length. I'm trying this:

{
   firstName: payload.FIRST_NAME
}

But I get the error:

sjsonnet.Error: attempted to index a array with string FIRST_NAME

It looks like xtrasonnet is loading all rows into memory and then expecting the transformation to specify a row index. What I'd like to do is stream through the input CSV file and have it apply the above transformation to each row. Is this possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.