mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 13:35:42 +09:00
refactor(api): tidy the api and shared packages (#2733)
This commit is contained in:
1 parent
580401d2dc
commit
5afbf67a70
333 files changed
+10180
-7910
No files matched your search
@@ -0,0 +1,12 @@
|
||||
import type {OpenAPIRef} from '@fluxer/openapi/src/OpenAPITypes';
|
||||
|
||||
export function validateOpenAPIComponentName(name: string): void {
|
||||
if (!/^[A-Za-z0-9._-]+$/.test(name)) {
|
||||
throw new Error(`Invalid OpenAPI schema name: ${name}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function createOpenAPIComponentRef(name: string): OpenAPIRef {
|
||||
validateOpenAPIComponentName(name);
|
||||
return {$ref: `#/components/schemas/${name}`};
|
||||
}
|
||||
Reference in new issue
Block a user