Skip to content

Validation only occurs at root level when there are nested Models #136

Description

@mightyhawkins

I have two Models defined; Location and Address, defined as follows:

"address": {
    "properties": {
        "address1": {
            "type": "string",
            "required": true
        }
    },
    "public": true,
    "dataSource": "db",
    "plural": "addresses"
},  
"location": {
    "properties": {
        "title": {
            "type": "string"
        },
        "address":{
            "type": "address",
            "required": true
        }
    },
    "public": true,
    "dataSource": "db",
    "plural": "locations"
}

When I Create an object based on the address Model via the API Explorer, the required constraint on address1 behaves as expected and I must supply a value to create the object.

When I Create an object based on the location Model via the API Explorer, the required constraint on the address works as expected, but the required constraint on the address1 of the address Model does not. I am able to create an address without an address1, which is not what I would expect.

I am using a memory datasource, node v0.10.24 and loopback v1.8.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions