views:

31

answers:

1

Basically I am looking to be able to reuse model definitions to target both Doctrine models and JSON-Schema.

I don't care if it means defining it in a 3rd model language and having the ability to convert that to both yml and json-schema or if it is from json-schema -> yml as long as I have 1 place to update both of them.

+3  A: 

Just off the top of my head, you could try parsing the YAML files into PHP arrays and then parsing the arrays into JSON with json_encode() or go the other way and json_decode() the JSON files and then parse the result into YAML format. The included sfYaml classes should be all you need for the YAML parsing/encoding and json_encode/json_decode are included in PHP 5.2 and up.

tsgrasser