Coder Social home page Coder Social logo

Comments (6)

andrewserff avatar andrewserff commented on August 16, 2024

Hi @lindajoseph01, I haven't verified with a test using your example, but I believe you are missing the {} around the item in the config. config is an array of objects. so it should look like:

...
"steps":[{
        "config":[{"repeat(3)",      {
                "timestamp": "nowTimestamp()",
                "system": "BADGE",
                "actor": "bob",
                "action": "ENTER",
                "objects": ["Building 1"],
                "location": "45.5,44.3",
                "message": "Entered Building 1"
            }
         }],
...

Try that out and see if that works

from json-data-generator.

lindajoseph01 avatar lindajoseph01 commented on August 16, 2024

Hey @andrewserff Thank you for your response:)

I tried to execute the test as you mentioned. I am getting the following error:

Error reading config: test
com.fasterxml.jackson.databind.JsonMappingException: Unexpected character (',' (code 44)): was expecting a colon to separate field name and value
at [Source: java.io.BufferedInputStream@5b8dfcc1; line: 10, column: 38] (through reference chain: net.acesinc.data.json.generator.workflow.Workflow["steps"]->java.util.ArrayList[0]->net.acesinc.data.json.generator.workflow.WorkflowStep["config"]->java.util.ArrayList[0])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210) ~[jackson-databind-2.5.2.jar:2.5.2]

I used the repeat special function exactly as described in the documentation.I want to create 3 copies of the array in config.

from json-data-generator.

andrewserff avatar andrewserff commented on August 16, 2024

Can you post your full config?

from json-data-generator.

caseycrites avatar caseycrites commented on August 16, 2024

This is an extremely old ticket and I doubt I'll get a response, but I'm having the exact same issue. I want to create a top-level json array:

[
  {
    ...json object from my config
  },
  {
    ..json object from my config with different values from functions
  }
]

but cannot figure out how to make that happen. I also tried the suggestion above and got the exact same error as @lindajoseph01.

This is my workflow definition based on the suggestion given here (there's nothing of note in the simulation config):

{
    "repeatWorkflow": true,
    "iterations": 10,
    "eventFrequency": 100,
    "steps": [
        {
            "config": [
                {
                    "repeat(10)", {
                        "customer_id": "uuid()",
                        "event_type": "SOMETHING_IMPORTANT",
                        "transaction_id": "uuid()",
                        "timestamp": "now()",
                        "properties": {
                            "casey": "crites"
                        }
                    }
                }
            ]
        }
    ]
}

even based on the syntax highlighting, it's not valid json. I've tried a few other things, like using repeat(10) as the key of the object, but that doesn't work either.

from json-data-generator.

caseycrites avatar caseycrites commented on August 16, 2024

based on the examples and the resources in the repo, my guess is this isn't supported. Everything points to the only arrays you can repeat are not top-level, but somewhere inside your json object.

from json-data-generator.

caseycrites avatar caseycrites commented on August 16, 2024

Yeah, the config section expects a List<Map<String, Object>> which wouldn't support top-level arrays.

from json-data-generator.

Related Issues (20)

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.