-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
example:
# api.raml
# minimized for brevity
types:
Post: !include types/post.raml
PublicPost: !include types/public-post.raml# types/post.raml
#%RAML 1.0 DataType
displayName: Post item
type: object
properties:
name:
description: Post item name.
type: string
required: true
content:
description: Content of the post item.
type: string
required: true# types/public-post.raml
#%RAML 1.0 DataType
displayName: Post item publicly available information
type: Post
properties:
owner-id:
description: Unique item id.
type: string
required: true
id:
description: Unique item id.
type: string
required: trueGenerated PublicPostNormalizer results in
// minimized for brievity
class PublicPostNormalizer implements NormalizerInterface, DenormalizerInterface
{
/**
* @param array $data
*
* @return PublicPost
*/
public function mapToEntity($data)
{
$entity = new PublicPost();
if (isset($data['owner-id'])) {
$entity->setOwnerId($data['owner-id']);
}
return $entity;
}
/**
* @param PublicPost $entity
*
* @return array
*/
public function mapFromEntity($entity)
{
return [
'id' => $entity->getId(),
'owner-id' => $entity->getOwnerId(),
];
}
}which lacks the required properties name and content defined in types/post.raml.
Metadata
Metadata
Assignees
Labels
No labels