Closed Bug 1385714 Opened 7 years ago Closed 7 years ago

Modify actions schema to be completely specified

Categories

(Taskcluster :: Services, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: hassan, Assigned: bstack)

References

Details

Attachments

(1 obsolete file)

When trying to build a form from a json-schema, some fields are not showing up. It turns out if an action schema has an object type without a "properties" property set, then it's hard to visualize it.

Example test-retrigger-action.py L60-65 [1]:

{
 `environment`: {
    'type': object,
    'default': {'MOZ_LOG': ''},
    'title': 'Extra environment variables',
    'description': 'Extra environment variables to use for this run'
  } 
}


I am suggesting that this schema is changed to something like that:

{
  'environments: {
    'type': 'array',
    'title': 'Extra environment variables',
    'items': {
      'type': 'object',
      'properties': {
        'key': {
          'type': 'string',
          'default': 'MOZ_CONFIG'
        },
        'value': {
          'type': 'string',
          'default': ''
        }
      }
    }
  }
}

For the example above, I am wrapping it with an array type to allow users to add as many environment variables (key-value pairs) as they wish.

This change will need to be applied to every schema that doesn't have a "properties" key.


As a result, Bug 1385467 will behave accordingly.

[1] http://searchfox.org/mozilla-central/source/taskcluster/actions/test-retrigger-action.py#60-65
Blocks: 1385467
Jonas, what do you think?  I feel like this is sort of limiting, as it will require some munging to get the array-of-objects form converted to an object of env vars..
Flags: needinfo?(jopsen)
I think the original should have been:
{
 'environment': {
    'type': object,
    'default': {'MOZ_LOG': ''},
    'title': 'Extra environment variables',
    'description': 'Extra environment variables to use for this run',
    'additionalProperties': {'type': 'string'}                             // <--- missed this part
  } 
}

---

I know bstack have mixed feelings about tweaking schemas to the whim of the ui-library used in some-tool.

On the other hand I'm sure we'll find certain patterns that works really well, and just use those,
ideally with UI generation falling back to a plain JSON editor if it can't figure out the schema.


Note: In general, it's true that array of object is often better, since you can add additional properties
      to the objects... You can't do that if you are using an object to create a map.
Flags: needinfo?(jopsen)
Assignee: nobody → bstack
Status: NEW → ASSIGNED
Summary: Modify actions schema slightly → Modify actions schema to be completely specified
Depends on: 1386449
Not going to do this right now as it turns out that it's quite difficult to specify a meta-schema for action tasks that is general enough to accept what we want while being specific enough to disallow what we don't want.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Attachment #8892669 - Attachment is obsolete: true
Component: Integration → Services
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: