Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

dispatch should check that the context is valid according to the dimensions #247

Closed
drewfish opened this Issue · 7 comments

4 participants

@drewfish
Owner

When we dispatch each mojit, make sure that the context used is valid according to the dimensions.json. This is because the context is used as the key for some caching, so it's a bad practice to put arbitrary keys/values into it.

@gvaish

How do I surface the data from middleware to controller then?

Define custom dimension?

@drewfish
Owner

You can have the middleware attach the data to the request object, then have the controller use the "mojito-http-addon" and call ac.http.getRequest() to get that request object.

Ideally Mojito would have an official way to support this.

@gvaish

I kind of support your idea.
Noting that req is the only unique object per request (at NodeJS level).

May be a simple add-on "mojito-shared-addon" would do... add to request at middleware layer and access via addon.
Well, the name may not sound good!

@caridy
Owner

guys, let's not pollute this issue, I have created a new issue #249 for the data sharing discussion.

@caridy
Owner

@gvaish there are not custom dimensions in mojito, that's the whole point of this issue, so we can keep the context domain finite.

@mridgway

@drewfish Is this now implemented in the new Resource Store?

@drewfish
Owner

Yes. The new RS has a validateContext(ctx) method, and uses it liberally. That method throws an error if the context keys/values aren't found in dimensions.json.

@drewfish drewfish closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.