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

fix: getDesignTypeForProperty #6701

Merged
merged 2 commits into from Nov 2, 2020
Merged

fix: getDesignTypeForProperty #6701

merged 2 commits into from Nov 2, 2020

Conversation

mdbetancourt
Copy link
Contributor

@mdbetancourt mdbetancourt commented Oct 31, 2020

Fixes #6522
after some checks i notice:

class MyModel {
      @propertyDecorator() // with decorator
      prop: string;
}
const meta = MetadataInspector.getDesignTypeForProperty(
      MyModel.prototype,
      'prop',
);
meta // String
---
class MyModel {
      @propertyDecorator()
      prop: string;
}
const meta = MetadataInspector.getDesignTypeForProperty(
      MyModel, // without prototype
      'prop',
);
meta // always undefined
---
class MyModel { 
      prop: string; // without decorator
}
const meta = MetadataInspector.getDesignTypeForProperty(
      MyModel.prototype,
      'prop',
);
meta // always undefined

so https://github.com/strongloop/loopback-next/blob/master/packages/metadata/src/__tests__/unit/inspector.unit.ts#L680-L687 is a useless tests (because always is gonna be undefined)
and https://github.com/strongloop/loopback-next/blob/0396ab058bc90d1a6a3da37f10353f481003301a/packages/metadata/src/inspector.ts#L210-L217 is not true

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

Signed-off-by: Michel Betancourt <michelbetancourt23@gmail.com>
Signed-off-by: Michel Betancourt <michelbetancourt23@gmail.com>
@raymondfeng raymondfeng marked this pull request as ready for review November 2, 2020 18:31
@raymondfeng raymondfeng merged commit 8aab137 into loopbackio:master Nov 2, 2020
2 checks passed
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.

getDesignTypeForProperty wrong code documentation
3 participants