Closed matleppa closed 6 years ago
Before PR #3093 the functionality was OK.
@matleppa Attention please this issue #3139
@marla-singer Sorry, I had wrong error list here. So I think this is not related to #3139.
@matleppa Can't agree with you. Based on error trace the 4 line shows the field with error
at Object.Apis.schema.SimpleSchema.updated_by.autoValue
My hypothesis is that it has started working incorrectly after PR #3099 and changing collection schema https://github.com/apinf/platform/blob/4763ed082f62a81ac5e84c91f6a666a8b9450183/apinf_packages/apis/collection/schema.js#L98-L108
Yes, I agree with you. I made a check by removing the #3093 functionality concerning PUT method, but the problem remained.
PR #3099 is clearly the culprit.
@matleppa Also please check if a filed "created_by" contains the correct value if API is added via REST API. I have feeling It will not work as expected
@marla-singer You are right, the created_by field is no updated, when an API card is created by Catalog API.
It seems, that at least following corrections should be made:
field updated_by get return value for autovalue function either from filled value (that's why in Catalog API the bodyParams.updated_by is filled) or from Meteor.userId()
Please make the same thing for created_by
field
Description
Method PUT fails
Environment
Postman testing Catalog API, method PUT
Result in localhost
Note! Replaced previous erroneous (unrelated, copy-paste error by me) errors with correct one
Error: Meteor.userId can only be invoked in method calls or publications. at AccountsServer.userId (packages/accounts-base/accounts_server.js:79:13) at Object.Meteor.userId (packages/accounts-base/accounts_common.js:263:19) at Object.Apis.schema.SimpleSchema.updated_by.autoValue (apinf_packages/apis/collection/schema.js:104:27) at Object.runAV (packages\aldeed_simple-schema.js:1282:26) at packages\aldeedsimple-schema.js:1383:13 at Array.forEach (native) at Function..each._.forEach (packages\underscore.js:139:11) at packages\aldeedsimple-schema.js:1382:7 at Function..each._.forEach (packages\underscore.js:147:22) at [object Object].getAutoValues (packages\aldeed_simple-schema.js:1345:5) at [object Object].SimpleSchema.clean (packages\aldeed_simple-schema.js:1763:42) at doClean (packages\aldeed_collection2-core.js:350:12) at [object Object].doValidate (packages\aldeed_collection2-core.js:372:3) at [object Object].Mongo.Collection.(anonymous function) [as update] (packages\aldeed_collection2-core.js:214:25) at Object.CatalogV1.addCollection.endpoints.put.action (apinf_packages/apis/server/api.js:668:14) at Route.share.Route.Route._callEndpoint (packages/nimble_restivus/lib/route.coffee:149:25) at packages/nimble_restivus/lib/route.coffee:59:33 at packages\simple_json-routes.js:98:9
Result in nightly
500 Internal Server Error
Testing with Swagger