Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enumeration values are not valid for labelOrientation #57

Closed
somedaygone opened this issue Mar 8, 2023 · 6 comments
Closed

Enumeration values are not valid for labelOrientation #57

somedaygone opened this issue Mar 8, 2023 · 6 comments

Comments

@somedaygone
Copy link

When using the enumeration for labelOrientation, it yields an error.

"labelOrientation": "horizontal",
"labelOrientation": "vertical",

image

The Schema should have something like:

                          "labelOrientation": {
                            "type": "string",
                            "enum": [
                              "horizontal",
                              "vertical"
                            ],
                            "title": "Orientation"
                          },

(Not sure if your convention is caps or lower, and not sure which value is 0 and which is 1!)

@somedaygone
Copy link
Author

somedaygone commented Mar 8, 2023

FYI, it looks like this similar issue may apply to other properties like radiusScalingMethod, barShape, orientation, expandCollapseToggleType, and position.

Try doing a find on integer enums:

"type": "integer", "enum"

My search found 34 occurrences that need to be updated for these properties.

@yelper
Copy link
Collaborator

yelper commented Mar 8, 2023

The error is correct, 0 and 1 are the only allowed values for label > labelOrientation. A type of "integer" and "enum" means that the values must be integers and also one of the listed values. 0 is vertical, and 1 is horizontal.

If you spot another issue, please let me know. I'll work on making this a bit more descriptive; the values of 0 and 1 are hard to discern. I'll probably end up following the convention described here, but this likely won't make it until the May Desktop release.

@somedaygone
Copy link
Author

The whole point of a string enum is because 0 and 1 don't mean anything in this context. Just look at any of the other string enums and you'll see that these should be string enums too. If you can tell without looking it up, keep them as integer, but I have no clue what barShape = 0 could possibly mean. Thankfully almost every other enum is descriptive like this one:

"shadowPositionPreset":{
    "type":"string",
    "enum":[
        "custom",
        "top",
        "topLeft",
        "topRight",
        "center",
        "centerLeft",
        "centerRight",
        "bottom",
        "bottomLeft",
        "bottomRight"
    ],
    "title":"Preset"
},

At a minimum, if you could add descriptions to the schema, it would help. I can find no documentation anywhere for these enums. Maybe in the title like this?

"labelOrientation": {
    "type": "integer",
    "enum": [
        0,
        1
    ],
    "title": "Orientation. 0 is vertial, 1 is horizontal."
},

Though I'd even be happy if you could just give the meanings here for radiusScalingMethod, barShape, orientation, expandCollapseToggleType, and position. I can't find any doc anywhere that gives the values for these.

@somedaygone
Copy link
Author

Sorry, just saw the link. Yes, adding a title on each integer would work. I think strings would match what is being used elsewhere, but I'm guessing that requires code changes elsewhere that won't happen for a long time. Thanks for taking this up!

@yelper
Copy link
Collaborator

yelper commented Apr 5, 2023

I've prototyped something for the May release, it'll look something like this (have to hover over the value to get the explanation, unfortunately):

image

Schema snippet:

"labelOrientation": {
    "type": "integer",
    "oneOf": [
        {
            "const": 0,
            "title": "Vertical"
        },
        {
            "const": 1,
            "title": "Horizontal"
        }
    ],
    "title": "Orientation"
},

@yelper
Copy link
Collaborator

yelper commented Nov 22, 2023

this shipped awhile ago, please let me know if you see any instances of numeric enums that don't have an explanation / English display name!

@yelper yelper closed this as completed Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants