Skip to content

Comments

Feat: fix file name#74

Merged
yndu13 merged 2 commits intomasterfrom
feature/fixfilename
Jan 9, 2026
Merged

Feat: fix file name#74
yndu13 merged 2 commits intomasterfrom
feature/fixfilename

Conversation

@TsinghuaDream
Copy link
Collaborator

No description provided.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


weeping seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

this.headers.push(`${this.modelHeader}/${canonicalName}.hpp`);

// 完全保持原始大小写,不做任何规范化
const canonicalKey = modelName.toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canonicalKey是不是应该使用原始modelName,你toLowerCase后,就会报OIDC和oidc同名

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块是因为,mac不区分大小写,没法生成不区分大小写同名的文件,所以加了一个规则:8. Model同名时,生成在一个文件中,但是生成两个class,文件名以先读取到的model name为准,例如下面这两个model,需要生成TestModelDir.hpp,而不生成TestModelDIR.hpp,然后其它文件include的时候,只需要引用TestModelDir.hpp,而不要引用未生产的TestModelDIR.hpp
model TestModelDir {
test: number,
m: User.Info
}

model TestModelDIR {
test: string,
a: any,
}

#include <darabonba/models/MoMValues.hpp>
#include <darabonba/models/MyModel.hpp>
#include <darabonba/models/Model.hpp>
#include <darabonba/models/model.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怎么变成小写了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原始model name就是小写的,新的文件我不区分大小写推送了。

lib/generator.js Outdated
// 所有 getter 方法都使用 get 前缀
const getterName = _getGetterName(name);
// 对于 params 变量,直接使用字段名;其他情况使用 get 前缀
const getterName = (expr === 'params') ? name : _getGetterName(name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前params的get方法也没有前缀吗

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有,当client中有doRPCRequest这种的时候,会导致编译报错,之前me没测出来~ 因为测试的产品都是走的callApi,但sts有匿名接口,会走doRPCRequest。
image

feat(generator): optimize getter access for system built-in types

- Add isSystemBuiltinType method to identify Darabonba system built-in types
- Remove get prefix for REQUEST, RUNTIME and system built-in type property access, use direct member method calls instead
- Use bracket access for property names with special characters to avoid compilation issues
- Optimize access pattern for request.query and request.headers properties using map bracket assignment
- Refactor getter call logic in generated code to improve readability and correctness
- Add command-line argument parsing and output directory generation script to generate.js
- Fix header file inclusion order to ensure Encoder header is properly included
- Update Client.cpp test fixtures to use new getter call convention
lib/generator.js Outdated
// 所有 getter 方法都使用 get 前缀
const getterName = _getGetterName(name);
// 对于 params 变量,直接使用字段名;其他情况使用 get 前缀
const getterName = (expr === 'params') ? name : _getGetterName(name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改掉

DaraLogger::log(err.getName());
} catch (const Darabonba::Exception err) {
DaraLogger::log(err.getName());
DaraLogger::log(err.name());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不同exception的方法不一致,后面会不会有隐患

lib/generator.js Outdated
// 对于 response_->的特殊字符属性,直接使用下标访问(不调用方法)
expr += `["${name}"]`;
} else {
expr += `->${name}()`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删掉吧

… calls

- Change runtime_.retryOptions() to runtime_.getRetryOptions()
- Change _context.exception() to _context.getException()
- Rename response_ class methods to add a get prefix (e.g., getStatusCode())
- Add get prefix to request accessors (e.g., getQuery(), getHeaders())
- Adjust model access handling for special naming and shared_ptr response types
- Remove the no-longer-used system builtin type check isSystemBuiltinType
- Make model empty() return true when the model has no fields
- Standardize all field getters to use the get prefix to avoid naming conflicts
@yndu13 yndu13 merged commit e56bfbf into master Jan 9, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants