Skip to content

Redefining controlled vocabularies #136

@JosePizarro3

Description

@JosePizarro3

@carlosmada22

I had an idea to make it easier for users to define the controlled vocabularies in the Python schema.

Right now, when someone wants to define a new property which is a CONTROLLEDVOCABULARY, they need to define PropertyTypeAssignment and then define the vocabulary with its code in the vocabulary_types.py. My idea would be to substitute this two-step by a one-step looking like:

class MyObject(ObjectType):
    defs = ...

    prop_1 = PropertyTypeAssignment(
        data_type=VARCHAR,
        ...
    )

    prop_2 = PropertyTypeAssignment(
        data_type=CONTROLLEDVOCABULARY,
        vocabularies=Enum("option1", "option2", "option3", ...),
        ...
    )

I.e., we change the fact of defining the vocabularies separately and instead define them directly in the PropertyTypeAssignment as an attribute.

I think this will simplify a lot the fact of defining over and over things in separated parts. At the end of the day, controlled vocabularies are Enums. We also should add a vocabularies_type for when these are booleans instead of plain text.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions