how to customize to Example Value

Id, name, desc .., created, modified I want to remove certain attributes from an attribute and create an example. Is that possible?
For example
{
"MobileNumber": "string",
"AuthNumber": 0,
"Auth": false,
"CreatedDt": "2017-04-21T15: 36: 18.544Z"
}
This data
{
"MobileNumber": "string"
}
I want to make this change.
I am wrong in English. Thank you for your understanding. Thank
@cheese10yun Not sure I understand your question correctly. The example json object has all the properties from your model. Hence, if your model does not have the mobileNumber property the REST call would not work.
@ssh24 Id, name, desc .., created, modified I want to remove certain attributes from an attribute and create an example. Is that possible?
For example
{
"MobileNumber": "string",
"AuthNumber": 0,
"Auth": false,
"CreatedDt": "2017-04-21T15: 36: 18.544Z"
}
This data
{
"MobileNumber": "string"
}
I want to make this change.
I am wrong in English. Thank you for your understanding. Thank
Are you saying you want to just insert the data as only? Something like this:
{
"MobileNumber": "string"
}
You can do that as long no other properties are marked as required. All required properties must be associated upon an insert.
@ssh24 In certain api, all properties are required
{
"MobileNumber": "string",
"AuthNumber": 0,
"Auth": false,
"CreatedDt": "2017-04-21T15: 36: 18.544Z"
}
On other api
{
"MobileNumber": "string"
}
You may only need attributes.
I want to send the body value easily by clicking on the Example value provided by swwager.
In other words, I want to set the Example Value differently for each
Is this possible?
Answer Thank you very much.
You cannot set the example value by itself. The example value by itself fetches all the properties from the model. You can edit it to set it to whatever attributes you want.
@ssh24
The reason I want this is because it is inconvenient to send the body value.
Is it impossible to utilize the swagger's Example Value if the body value of each API is different?
If so, is not the purpose of the Example Value easy to transfer the body value?
I am not sure of what you mean. The swagger example value fetches the json object and it's properties depending on the model properties. They are not hard coded to have the same values for each model unless obviously all the models have the same property.
@ssh24 I was misunderstanding.
I understand that Example Value is the ability to conveniently send body values.
Is it not showing the properties of the model?
I really appreciate the answer.
@cheese10yun It should show all the properties of the model and if you try to do a REST call with a property that is not part of the model, it should throw an error.
@ssh24 I understood so much differently.
I understood because of you.
Thank you very much.
@cheese10yun You are welcome.
Closing this issue since it is resolved, feel free to reopen it if needed.
Id, name, desc .., created, modified I want to remove certain attributes from an attribute and create an example. Is that possible?
For example
{ "MobileNumber": "string", "AuthNumber": 0, "Auth": false, "CreatedDt": "2017-04-21T15: 36: 18.544Z" }This data
{ "MobileNumber": "string" }I want to make this change.
I am wrong in English. Thank you for your understanding. Thank
yes... we can do it change the model js file. when we create remoteMethod; we provide accepts array. there is arg, type, required, http. then we can give our request object into type parameter.
follow the example code.
UserModel.remoteMethod(
'login',
{
description: 'Login a user with username/email and password.',
accepts: [
{
arg: 'credentials',
type: {'email': 'string', 'password': 'string'},
required: true,
http: {source: 'body'},
},
{
arg: 'include', type: ['string'], http: {source: 'query'},
description: 'Related objects to include in the response. ' +
'See the description of return value for more details.',
},
],
returns: {
arg: 'accessToken', type: 'object', root: true,
description:
g.f('The response body contains properties of the {{AccessToken}} created on login.\n' +
'Depending on the value of `include` parameter, the body may contain ' +
'additional properties:\n\n' +
' - `user` - `U+007BUserU+007D` - Data of the currently logged in user. ' +
'{{(`include=user`)}}\n\n'),
},
http: {verb: 'post'},
},
);