MichalLytek / MichalLytek/type-graphql
Does emitting @Authorization roles into property/method description makes sense?
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 672
- PR merge metrics
- No merged PRs in 30d
Description
Before I send pull request I want to make sure I am thinking about this the right way. I patched the compiled metadata-generator code to test this idea. For real code I would presume some configuration, customized text, filtered (internal roles) not showing in docs etc.
```buildClassMetadata(definitions) {
definitions.forEach(def => {
const fields = this.fields.filter(field => field.target === def.target);
fields.forEach(field => {
....
if(field.roles) {
field.description = (field.description ? field.description : '') + `
user can authorize via roles: ${Array.isArray(field.roles) ? field.roles.join(): field.roles}
`
}
});
def.fields = fields;
});
}```
Contributor guide
Research direction
Start by reviewing the proposed buildClassMetadata snippet in the issue and locate the current metadata generation entry point. Decide whether authorization roles belong in property or method descriptions, including the proposed configuration and filtering concerns; done should be a documented project decision with an agreed scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100