8000 Documentation about validation of relationships object using getResourceObject · Issue #2 · cloudcreativity/laravel-json-api · GitHub
[go: up one dir, main page]

Skip to content
Documentation about validation of relationships object using getResourceObject #2
Closed
@mosen

Description

@mosen

Hey there,
Forgive me if I read incorrectly, but I don't think there's any documentation about validating relationships as part of a new resource creation, such as the request body shown in the example under http://jsonapi.org/format/#document-resource-objects

The current solution I'm using is to manually construct the relationships validator and set it on the main resource validator. eg.

$validator = $this->getResourceObjectValidator(...)
$validator->setRelationshipsValidator(new RelationshipsValidator([
   'relationshipName' => $this->getHasOneValidator('relationship_type')
]);

Although I'm not 100% sure that this is the recommended method.
If you would like me to submit a change to README to that effect under content validation, I'm happy to do that too.

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

      0