Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for $ref on properties #317

Merged
merged 2 commits into from Oct 10, 2016
Merged

Add support for $ref on properties #317

merged 2 commits into from Oct 10, 2016

Conversation

shmax
Copy link
Collaborator

@shmax shmax commented Oct 9, 2016

Adds support for $ref on the properties attribute. You don't often see examples of this kind of thing out there in the wild, but $ref is actually not defined by the json schema standard; it's more of a JSON thing , and it's very useful in situations where you want to make properties of something reusable while still controlling a custom description or name:

$schema = [
   "frontPhoto"=>[
       "type"=>"object",
       "description" => "Supply a nice photo of the front of the object you want to sell",
       "properties" => [
          '$ref' => '/path/to/photo.attributes.json'
       ]
   ],
  "backPhoto"=>[
       "type"=>"object",
       "description" => "See if you have a nice photo of the back of the object you want to sell. This photo is optional",
       "properties" => [
          '$ref' => '/path/to/photo.attributes.json'
       ]
   ]
];

@shmax shmax changed the title add support for on properties Add support for $ref on properties Oct 9, 2016
@shmax
Copy link
Collaborator Author

shmax commented Oct 9, 2016

@bighappyface please review

'yard' => (object) array(
'type' => 'object',
'additionalProperties' => false,
'properties' => (object)[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array for PHP 5.3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Fixed, thanks...

@bighappyface
Copy link
Collaborator

+1

@bighappyface bighappyface merged commit d701d8f into justinrainbow:master Oct 10, 2016
@shmax
Copy link
Collaborator Author

shmax commented Oct 10, 2016

Thanks for the quick turnaround 👍

@shmax shmax deleted the properties-ref branch October 10, 2016 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants