Queue schema jsons

Hi there,
I am looking at the new schemas json trying to understand how to create it and what are they meant at. Unfortunatelly I cannot find infos about that on the documentation (nothing more than a few examples).

Specifically:

  1. Which is the format of the JSON for the “input schema” which infos can I insert? Which types of data?

  2. The same for the output schema, where I am guessing that the schema is for the download queue button.

  3. And what about the analytics? What does it do?

Thank you for your help
Giuseppe

3 Likes

i will risk it and say it is there just as a reference for any developers that will be using those, so they know the schema they will need to follow when adding or retrieving transactions…

I was able to upload a JSON using the schema like the link below.

Hope it helps.

I was looking into this today and this was one of the top search results but doesn’t seem to explain it in any detail so here is what I found myself.

So, on a queue item you have the following properties:

  • SpecificData (populated when the queue item is created)
  • OutputData (populated when the queue item is completed)
  • AnalyticsData (populated when the queue item is completed)

The three JSON schemas you can upload in orchestrator correspond to these properties and basically allow an automatic validation of the data in those fields at various stages.

For example, if you have a JSON Schema for the Specific Data when you try to add an item to a queue the input data will be checked to see if it matches the schema, if it does not then the queue item will not be added and a business exception will occur.

The other two schemas are validated when the queue item status is set to ‘Successful’, if either validation fails then the queue item will fail with a business exception.

Hopefully you can see scenarios where this is useful in validating data. Here are some further reading which I think help explain it further.

1 Like

Does anyone know what the syntax of the JSON schema needs to be for Orchestrator to enforce it?

I found an example on YouTube here: How to use Orchestrator Queues in UiPath - Tutorial - YouTube.

As a test, I created a similar schema and uploaded it to a test queue under Specific Data JSON Schema. Orchestrator accepted it.

My schema:

{
    "title": "Test",
    "type": "object",
    "properties": {
        "firstName": {
            "type": "string",
            "description": "The person's first name."
        },
        "lastName": {
            "type": "string",
            "description": "The person's last name."
        },
        "age": {
            "description": "Age in years which must be equal to or greater than zero.",
            "type": "integer",
            "minimum": 0
        }
    }
}

Next, I went into Studio and added an Add Queue Item activity. I set ItemInformation as shown in the screenshot.

An ItemInformation dialog in UiPath Studio with keys for Name and Show

When I run the project, an item is always added to the queue, despite the JSON schema not having Name or Show properties.

What am I missing?

So the behaviour makes sense. I’ll try to explain by describing what your schema demands.

  • a firstName (optional) field of string type,
  • a lastName (optional) field of string type,
  • an age field (optional) of integer type, if filled has a minimum value of 0

The schema doesn’t stop extra fields being present so if we check against these rules your JSON input would validate against the schema as all the fields specified are missing, since they are all optional this is fine.

Now I’m no expert on JSON schemas as I work more frequently with XML but I think you want to look at adding something like this to your file
“required”: ["firstName ", "lastName ", "age "],
You would then need to provide a value for those 3 fields meaning your input would now fail the validation.

I think it bears pointing out that the schema validation only occurs on certain activities as far as I know. Changing the SpecificData dictionary directly in a workflow probably won’t trigger a validation check.

1 Like

@Jon_Smith, that worked…Thanks for the info.

I didn’t really connect the dots until your answer that this is the JSON Schema defined here: https://json-schema.org/. This is my first real encounter with it beyond as a consumer.

Adding a $schema property to my JSON gave me autocomplete in VS Code. Adding required as you suggested made Add Queue Item throw an error in Studio for the ItemInformation screenshotted in my previous post.

{
    "$schema": "http://json-schema.org/draft/2020-12/schema",
    "title": "Test",
    "type": "object",
    "properties": {
        "firstName": {
            "type": "string",
            "description": "The person's first name."
        },
        "lastName": {
            "type": "string",
            "description": "The person's last name."
        },
        "age": {
            "description": "Age in years which must be equal to or greater than zero.",
            "type": "integer",
            "minimum": 0
        }
    },
    "required": ["firstName", "lastName", "age"]
}

Sorry for addressing you as “anyone” in my previous post, by the way…I had edited the opening before posting, and by that time I forgot I’d started it as a reply. :slight_smile:

2 Likes

A schema example is also in the UiPath documentation

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.