serby / schemata

Define, create, and validate your business objects based on specified schema.
45 stars 16 forks source link

Sub schemas return an array of empty objects #4

Closed IamSmith closed 11 years ago

IamSmith commented 11 years ago

When saving a object which contains a sub schema, although the sub schema object is posted correctly, the response when saving it show an array of empty objects

Post { name: "tom", contactMeans: [ { type: "telephone", number: "01234 567890"}, { type: "email", number: "test@test.com"} ]}

Response { name: "tom", contactMeans: [{}, {}]

domharrington commented 11 years ago

This sounds like it could be a save issue? As schemata has nothing to do with saving, only stripping and validating.

IamSmith commented 11 years ago

I have some more information on this. The main schema is using tags, and unless the sub schema properties have that tag in each of its properties they are being stripped and hence why an empty object is being passed to save.

I believe this is a bug as tags should be ignored when saving subschemas. Do you agree?

serby commented 11 years ago

I'm not sure actually, that make saving just one sub schema property impossible.

On Thursday, March 28, 2013, Tom Smith wrote:

I have some more information on this. The main schema is using tags, and unless the sub schema properties have that tag in each of its properties they are being stripped and hence why an empty object is being passed to save.

I believe this is a bug as tags should be ignored when saving subschemas. Do you agree?

— Reply to this email directly or view it on GitHubhttps://github.com/serby/schemata/issues/4#issuecomment-15582029 .

Sent from a phone

IamSmith commented 11 years ago

Related pull request: https://github.com/serby/schemata/pull/8