This commit is contained in:
2025-09-27 06:22:45 +04:00
parent 5fc7823f4b
commit 4662ce3c02
5 changed files with 15 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ pub mut:
pub struct DBFs {
pub mut:
db &db.DB @[skip; str: skip]
factory &ModelsFactory = unsafe { nil } @[skip; str: skip]
factory &FSFactory = unsafe { nil } @[skip; str: skip]
}
pub fn (self Fs) type_name() string {
@@ -268,7 +268,7 @@ pub fn (mut self DBFs) check_quota(id u32, additional_bytes u64) !bool {
return (fs.used_bytes + additional_bytes) <= fs.quota_bytes
}
pub fn fs_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
pub fn fs_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
match method {
'get' {
id := db.decode_u32(params)!

View File

@@ -19,7 +19,7 @@ pub mut:
pub struct DBFsBlobMembership {
pub mut:
db &db.DB @[skip; str: skip]
factory &ModelsFactory = unsafe { nil } @[skip; str: skip]
factory &FSFactory = unsafe { nil } @[skip; str: skip]
}
pub fn (self FsBlobMembership) type_name() string {
@@ -257,7 +257,7 @@ pub fn (self FsBlobMembership) example(methodname string) (string, string) {
}
}
pub fn fs_blob_membership_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
pub fn fs_blob_membership_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
match method {
'get' {
hash := db.decode_string(params)!

View File

@@ -23,7 +23,7 @@ pub mut:
pub struct DBFsDir {
pub mut:
db &db.DB @[skip; str: skip]
factory &ModelsFactory = unsafe { nil } @[skip; str: skip]
factory &FSFactory = unsafe { nil } @[skip; str: skip]
}
pub fn (self FsDir) type_name() string {
@@ -330,7 +330,7 @@ pub fn (self FsDir) example(methodname string) (string, string) {
}
}
pub fn fs_dir_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
pub fn fs_dir_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
match method {
'get' {
id := db.decode_u32(params)!

View File

@@ -27,7 +27,7 @@ pub enum SymlinkTargetType {
pub struct DBFsSymlink {
pub mut:
db &db.DB @[skip; str: skip]
factory &ModelsFactory = unsafe { nil } @[skip; str: skip]
factory &FSFactory = unsafe { nil } @[skip; str: skip]
}
pub fn (self FsSymlink) type_name() string {
@@ -212,7 +212,7 @@ pub fn (self FsSymlink) example(methodname string) (string, string) {
}
}
pub fn fs_symlink_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
pub fn fs_symlink_handle(mut f FSFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response {
match method {
'get' {
id := db.decode_u32(params)!

View File

@@ -61,10 +61,13 @@ pub fn from_openrpc(openrpc_spec openrpc.OpenRPC, config IntermediateConfig) !In
return error('handler_type cannot be empty')
}
// Process schemas
mut schemas_map := process_schemas(openrpc_spec.components.schemas)!
mut intermediate_spec := IntermediateSpec{
info: openrpc_spec.info
methods: []IntermediateMethod{}
schemas: process_schemas(openrpc_spec.components.schemas)!
schemas: schemas_map
base_url: config.base_url
}
@@ -183,7 +186,10 @@ fn extract_type_from_schema(schema_ref jsonschema.SchemaRef) string {
fn process_schemas(schemas map[string]jsonschema.SchemaRef) !map[string]IntermediateSchema {
// Initialize the map with a known size if possible
mut intermediate_schemas := map[string]IntermediateSchema{}
// Process each schema in the map
for name, schema_ref in schemas {
if schema_ref is jsonschema.Schema {
schema := schema_ref as jsonschema.Schema