Skip to content

Required field on relations #505

@cajoy

Description

@cajoy

I have model like

  "properties": {
    "id": {
      "type": "string",
      "id": true
    },
    "name": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    }
  },
  "dataSource": "mongodb",
  "validations": [],
  "relations": {
    "user": {
      "type": "belongsTo",
      "model": "user",
      "foreignKey": "userId",
      "required": true
    }
  },

And user should be required for all records. But I can easilly create record without user. "required" is not working for related models.

May be I can create validator but I prefer native support.

Alex

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions