Create a model
landing-page-data-add-member.json
{
"name": "LandingPageDataAddMember",
"base": "AbstractModel",
"description": "Options object for landingPage.addPerson method.",
"excludeBaseProperties": [ "id" ],
"properties": {
"person": {
"type": "String"
}
}
Create another model that defines a remote method which defines an input parameter that uses the type of the previous model. eg:
landing-page.json
{
"name": "LandingPage",
"base": "PersistedModel",
"properties": {
"prototype.addMember": {
"accepts": [{
"arg": "data",
"type": "LandingPageDataAddMember",
"required": true,
"description": "Landing Page Person data.",
"http": {
"source": "body"
}
}],
And both models model-config.json, with the 'embedded' model set with public=false
model-config.json
"LandingPage": {
"dataSource": "db",
"public": true
},
"LandingPageDataAddMember": {
"dataSource": "transient",
"public": false
},
When you call the remote method you get a warning like this in the console:
Treating unknown remoting type "landingpagedataaddprospect" as "any"
If you set the model to public the warning goes away... but we don't want this model to be public.
You can suppress the warning by setting warnOnUnknownType to false in config.json:
"remoting": {
"types": {
"warnOnUnknownType": false
},
The model should be registered as a known type when it is added to model-config.json, regardless of wether it is public or not.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Yes, I am facing the same problem. Would appreciate if any one could point out the reason.
Same here
Making it public solved the issue for me too. You can get rid of the exposed methods using Whitelist
Mixin. Not the most elegant solution but it gets the job done.
Just add something like this to your exposed model. (It won't be displayed in the explorer if none of its methods are exposed.)
"mixins": {
"MethodWhitelist": {
"expose": []
}
}
Thanks, I was trying to define in memory db inside the corresponding model another one, This solution is good for me
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.
But why
why does this happen? an explanation?
One more trick to get rid of the warning:
"LandingPageDataAddMember": {
"dataSource": "transient",
"public": true,
"options": {
"remoting": {
"sharedMethods": {
"*": false
}
}
}
}
I would like to keep the model from being exposed on the REST API, but suppress the warning. Is there some way of doing that currently?
Most helpful comment
But why