# Perspective Component Schema Help

**URL:** <https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561>\
**Category:** Module Development\
**Tags:** perspective\
**Created:** [August 12, 2024, 9:45pm UTC](https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561 "2024-08-12T21:45:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [August 12, 2024, 9:45pm UTC](https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561/1 "2024-08-12T21:45:16Z")

</div>

@paul-griffith Got a couple questions about how to get some property hints working in the designer:

1. `additionalProperties` and `patternProperties` seem to only work for validation, but do not provide hints for matching properties.

I would like to do something like this: scales `x`, `y`, and `r` are known common properties and have designer hints when adding properties to `scales`, but any other keys are also valid and have schema hints after they are manually created.

```python
"scales": {
    "default": {},
    "description": "Chart scale options.",
    "type": "object",
    "properties": {
        "x": {
            "required": false,
            "$ref": "#/$defs/scale_options"
        },
        "y": {
            "required": false,
            "$ref": "#/$defs/scale_options"
        },
        "r": {
            "required": false,
            "$ref": "#/$defs/scale_radial_options"
        }
    },
    "additionalProperties": {
        "$ref": "#/$defs/scale_options",
    }
}

```

I get schema hints for `x`, `y`, and `r`, but no hints for additional properties. Is this possible?

* * *

1. This there a way to point `dynamicSuggestions` at the key-names of an object? This example shows how to create a list of `names` from all `axis[key]s`, but I need a list of `keys` (the `x`, `y`, `r`, and any additional `scales` from question 1):

[Example](https://github.com/mussonindustrial/embr/issues/166#issuecomment-2276919532)

I've tried `../scales/*` and `../scales` with no luck. If I do something like `../scales/*/type` I can get the suggestion list to populate similarly to the example, but it's not what I'm after. Again, is this possible?

Thanks 🙃

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 15, 2024, 3:53pm UTC](https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561/2 "2024-08-15T15:53:00Z")

</div>

> [@bmusson](#):
>
> Is this possible?

Probably not.  
Our JSON editor is homegrown and only as smart as we've needed it to be for first party functionality, so there's lots of edge cases in the implementation of property suggestion logic where something might make sense, but isn't quite there.

> [@bmusson](#):
>
> is there a way to point `dynamicSuggestions` at the key-names of an object?

Also probably not, for much the same reason. Maybe something with the position of the asterisk, but it doesn't seem like it's written to support what you're trying to do, from a quick look at `com.inductiveautomation.ignition.client.jsonedit.ChoicePicker`.

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [August 15, 2024, 4:00pm UTC](https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561/3 "2024-08-15T16:00:51Z")

</div>

👍 That's what I figured, but wanted to be 100% sure. Thanks for checking.

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [October 24, 2024, 4:58am UTC](https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561/4 "2024-10-24T04:58:28Z")

</div>

I've found that I can make a property use a style-class picker with:

```python
"myProp": {
  "type": ["array", "string"],
  "format": "style-list"
}

```

Which is cool, except the values returned by the `style-list` selector aren't the CSS class names (`.psc-Folder\/NestedFolder\/myPSC`), but are instead the resource path (`Folder/NestedFolder/myPSC`).

Is there a built in method of converting the resource path to a CSS class name in `@inductiveautomation/perspective-client`?

The conversion isn't complicated but it seems like something that should be available in the SDK. I'm guessing it's something `Emitter` related?

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [October 24, 2024, 3:14pm UTC](https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561/5 "2024-10-24T15:14:24Z")

</div>

I was way overthinking this.  
You literally just append `psc-` to the start of the class names. 🫥

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 24, 2024, 3:32pm UTC](https://forum.inductiveautomation.com/t/perspective-component-schema-help/94561/6 "2024-10-24T15:32:50Z")

</div>

All the style class manipulation is backend/Java code.  
com.inductiveautomation.perspective.common.config.styles.StyleClassConfig#toCss

> **[StyleClassConfig](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.44/com/inductiveautomation/perspective/common/config/styles/StyleClassConfig.html)**
>
> declaration: package: com.inductiveautomation.perspective.common.config.styles, class: StyleClassConfig

But the rule is quite simple - `.psc-` + folder path, with forward slashes escaped.
