Nested dynamics types isn't work
gustavorodarte opened this issue · 2 comments
gustavorodarte commented
When execute the code below throws the following error message.
Error: "userPersonalInformation.vehicle" contains link reference "ref:local:Vehicle" which is outside of schema boundaries
The same not happen when removing the dynamic type;
const { attributes } = require('structure');
const Vehicle = attributes({
year: {
type: Number,
required: true,
},
})(class Vehicle {});
const UserPersonalInformation = attributes(
{
name: String,
vehicle: 'Vehicle',
},
{
dynamics: {
Vehicle: () => Vehicle,
},
},
)(class UserPersonalInformation {});
const AutoRiskProfile = attributes(
{
userPersonalInformation: {
type: 'UserPersonalInformation',
required: true,
},
},
{
dynamics: {
UserPersonalInformation: () => UserPersonalInformation,
},
},
)(class AutoRiskProfile {});
const autoRiskProfile = AutoRiskProfile.buildStrict({
userPersonalInformation: new UserPersonalInformation({
name: 'a',
vehicle: new Vehicle({
year: 2018,
}),
}),
});
talyssonoc commented
Hello, @gustavorodarte, I'll verify and try to fix!
talyssonoc commented
Hey @gustavorodarte, structure 2.0.1 was just released with a fix for the issue.