Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In ServiceController's "create" method a optional param is actually required #4424

Closed
Xezeloh opened this issue Dec 8, 2020 · 6 comments
Closed
Assignees
Milestone

Comments

@Xezeloh
Copy link

@Xezeloh Xezeloh commented Dec 8, 2020

Describe the bug
In the naming module, ServiceController's "create" method has an optional parameter protectThreshold. However, since it is a basic type and has no default value, if this parameter is not provided in actual use, an error will be reported.
naming模块中,ServiceController的create方法有一个可选参数protectThreshold,但由于其是基本类型且无默认值,在实际使用中如果不提供这个参数会导致报错。

Expected behavior
A request sent to the api create with out the param protectThreshold get an ok returned.

Acutally behavior
nacos return this:
caused: Optional float parameter 'protectThreshold' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.;

How to Reproduce
curl -X POST "127.0.0.1:8848/nacos/v1/ns/service?serviceName=12e"

Desktop (please complete the following information):

  • OS: Windows 10
  • Version nacos-server 1.3.2
  • Module naming

Additional context
No

@neighbor-uncleWang
Copy link
Contributor

@neighbor-uncleWang neighbor-uncleWang commented Dec 9, 2020

@i will solve it@

Loading

@neighbor-uncleWang
Copy link
Contributor

@neighbor-uncleWang neighbor-uncleWang commented Dec 9, 2020

To archive this goal,here is my plan:
Modify the parameter to the packaging type, and then convert the null to 0.0L in the method.

我的计划是:
将参数修改为包装类型,然后在方法里面将null转换为0.0L。

Loading

@Xezeloh
Copy link
Author

@Xezeloh Xezeloh commented Dec 10, 2020

To archive this goal,here is my plan:
Modify the parameter to the packaging type, and then convert the null to 0.0L in the method.

我的计划是:
将参数修改为包装类型,然后在方法里面将null转换为0.0L。

那为啥不直接在形参那儿赋个默认值0.0

Loading

@neighbor-uncleWang
Copy link
Contributor

@neighbor-uncleWang neighbor-uncleWang commented Dec 10, 2020

对耶,默认值直接defaultValue

Loading

@liuweizhenhaoa
Copy link

@liuweizhenhaoa liuweizhenhaoa commented Dec 17, 2020

对耶,默认值直接defaultValue

i want to know did you submit this issue

Loading

@neighbor-uncleWang
Copy link
Contributor

@neighbor-uncleWang neighbor-uncleWang commented Dec 17, 2020

周末再提交,最近工作日比较忙

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants