MichalLytek / MichalLytek/type-graphql

Does emitting @Authorization roles into property/method description makes sense?

Open
#511 5 comments 1 reaction 0 assignees View on GitHub
Community :family_man_girl: Enhancement :new:
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.