Skip to content

required properties are not enforced #10

@donalmurtagh

Description

@donalmurtagh

In both the camelcase and minimal examples there are 2 fields of the custom type, one of which is optional and the other is required. For example, in the schema of the minimal example, it's the 2nd field that's required

    $scope.schema = {
        type: "object",
        title: "Minimal",
        properties: {
            minimalFormat: {
                type: "string",
                format: "minimal",
                description: "When you edit this, it is in the add-ons input box."
            },
            minimalFormType: {
                type: "string",
                description: "When you edit this, which is required, it is equally in the add-ons input box"
            }
        },
        required: ["minimalFormType"]
    };

However, if we change the form's submission handler to:

    $scope.submitted = function (form) {
        $scope.$broadcast("schemaFormValidate");
        console.log($scope.model);

        // the line below is the only change I made to this function
        console.log('Form is valid:', form.$valid);
    };

We'll see that the form is considered valid even if nothing is entered in the required field

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions