{"id":18832360,"url":"https://github.com/brainpoint/febs-decorator","last_synced_at":"2026-01-25T09:30:16.273Z","repository":{"id":57234189,"uuid":"304932722","full_name":"brainpoint/febs-decorator","owner":"brainpoint","description":"Some typescript decorator which use in front-end and back-end","archived":false,"fork":false,"pushed_at":"2021-05-26T03:38:48.000Z","size":563,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T11:34:58.147Z","etag":null,"topics":["annotation","nodejs-spring-validation","spring","spring-validation","typescript-decorator","validation","validator-decorator"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brainpoint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-17T17:29:57.000Z","updated_at":"2021-05-26T03:38:51.000Z","dependencies_parsed_at":"2022-09-15T02:51:07.471Z","dependency_job_id":null,"html_url":"https://github.com/brainpoint/febs-decorator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brainpoint","download_url":"https://codeload.github.com/brainpoint/febs-decorator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239768935,"owners_count":19693763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotation","nodejs-spring-validation","spring","spring-validation","typescript-decorator","validation","validator-decorator"],"created_at":"2024-11-08T01:57:39.083Z","updated_at":"2026-01-25T09:30:16.174Z","avatar_url":"https://github.com/brainpoint.png","language":"TypeScript","readme":"\nSome typescript decorators, like spring-validation and so on.\n\n- [Setup](#setup)\n- [Example](#example)\n- [Reference](#reference)\n  - [Validator Decorator](#validator-decorator)\n  - [Rest Decorator](#rest-decorator)\n\n## Setup\n\n```\nnpm i febs-decorator\n```\n\nset config in tsconfig.json\n\n```\n\"experimentalDecorators\": true,\n\"emitDecoratorMetadata\": true,\n```\n\n## Example\n\n\nValidation Example:\n\n```js\nimport {NotNull, Type} from 'febs-decorator';\n\nclass BeanDemo {\n    @NotNull\n    @Type.Boolean\n    a: boolean = null\n}\n\nlet obj = new BeanA();  // will throw a exception.\n```\n\nService Example:\n\n```js\nimport {Service} from 'febs-decorator';\n\n@Service()\nclass BeanDemo {\n}\n\n// get service instances.\n@Autowired(BeanDemo)\nlet objArray:any[];\n```\n\nBean Example:\n\n```js\nimport {Service, Bean} from 'febs-decorator';\n\n@Service()\nclass BeanDemo {\n  @Bean()\n  foo(): Object {\n    return {};\n  }\n}\n\n// get bean instances.\n@Autowired('foo')\nlet obj:Object;\n```\n\nFeignClient Example:\n\n```js\nimport { RestController, RequestMapping, RequestMethod } from \"febs-decorator\";\n\n@FeignClient({name:'serviceName'})\nexport class BaseService {\n  @RequestMapping({ path: '/api', method: RequestMethod.GET, feignCastType: BeanDemo })\n  async request(): Promise\u003cBeanDemo\u003e {\n    // fallback.\n    throw new Error('Message Error');\n  }\n}\n\n// request\nlet result:BeanDemo = new BaseService().request();\n```\n\n## Reference\n\n### Validator Decorator\n\nsee [readme](./libs/validator/readme.md)\n\nA set of validator decorators, e.g. `@NotNull`, `@Max`, `@Min`, `@Range` ..\n\n### Rest Decorator\n\nsee [readme](./libs/rest/readme.md)\n\nA set of restful api decorators, e.g. `@RestController`, `@FeignClient`, `@RequestMapping`, `@RequestBody`, `@PathVariable` ..\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainpoint%2Ffebs-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrainpoint%2Ffebs-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainpoint%2Ffebs-decorator/lists"}