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

Nested dynamics types isn't work #132

Closed
gustavorodarte opened this issue May 21, 2020 · 2 comments · Fixed by #138
Closed

Nested dynamics types isn't work #132

gustavorodarte opened this issue May 21, 2020 · 2 comments · Fixed by #138

Comments

@gustavorodarte
Copy link

gustavorodarte commented May 21, 2020

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
Copy link
Owner

Hello, @gustavorodarte, I'll verify and try to fix!

@talyssonoc
Copy link
Owner

Hey @gustavorodarte, structure 2.0.1 was just released with a fix for the issue.

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 a pull request may close this issue.

2 participants