You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes we need to keep multiple versions of the same API in a codebase. This typically involved a different base path for each api like /v1/user/:userid, /v2/user/:userid etc. Currently this is possible in Godspeed via adding this base path in each endpoint separately. It should be able to be done at level of a group of events kept in a folder. this can be done by a custom base_url in each folder.
Similarly, one should be able to setup custom authz, validation_error handlers, middleware per event group stored in a separate folder in src/events
The Solution
In eventsource yaml file, allow the event source settings per folder as well.
Default values will float in this sequence - Eventsource -> Event group -> Event
#common to all events and event groupstype: expressport: 9009# Settings common to all events and event groups but customizable at event group and event levelfile_size_limit: 50000000request_body_limit: 20000000base_url: /http2middlewares: #Each middleware type can be a string[], string or JSONTask[]inputs:
native: &original_native # will run before input validation
- com.biz.express.google_oauth2
- com.biz.express.file_upload
- com.biz.express.set_multiple_custom_middlewaresgeneric: #will run after input validation
- id: fetch_user_detailssummary: call a database and get more details of userfn: com.biz.enrich_user_details
- id: fetch_policiessummary: call a policy engine to get ACLs for RBAC or ABAC, and enrich the inputs.data objectfn: com.biz.fetch_policiesoutputs: # output data validation will run after all the output middlewaresnative: | #will run after generic middlewares # can run a JS to evaluate a dynamically calculated list of middlewares <% middlewares.com_biz_express_some_middlewares_list .concat(middlewares.com_biz_express_other_middlewares_list)%>generic: #will run before native middlewares
- id: kafka_publishsummary: send an event to kafkafn: datasource.kafka.<topic_name>.producerargs:
topic: api_calledmessage: <% outputs.body.message%>authz:
- fn: com.gs.transformid: http_default_authzargs:
success: falsemessage: "EventSource authz failed"on_request_validation_error:
- fn: com.gs.transformid: xargs: {success: false, code: 400, message: "shit", data: {req: true}}on_response_validation_error:
- fn: com.gs.transformid: xargs: {success: false, code: 500, message: "shit", data: {res: true}}event_groups:
v1_events:
file_size_limit: 50000000request_body_limit: 20000000base_url: /http2middlewares: #Each middleware type can be a string[], string or JSONTask[]inputs:
native: # will run before input validation - *original_native
- com.biz.express.some_othergeneric: null # In this ex. we remove generic. If was set - will run after input validation# - id: fetch_user_details# summary: call a database and get more details of user# fn: com.biz.enrich_user_details# - id: fetch_policies# summary: call a policy engine to get ACLs for RBAC or ABAC, and enrich the inputs.data object# fn: com.biz.fetch_policiesoutputs: # output data validation will run after all the output middlewaresnative: | #will run after generic middlewares # can run a JS to evaluate a dynamically calculated list of middlewares <% middlewares.com_biz_express_some_middlewares_list .concat(middlewares.com_biz_express_other_middlewares_list)%>generic: #will run before native middlewares
- id: kafka_publishsummary: send an event to kafkafn: datasource.kafka.<topic_name>.producerargs:
topic: api_calledmessage: <% outputs.body.message%>authz:
- fn: com.gs.transformid: http_default_authzargs:
success: falsemessage: "EventSource authz failed"on_request_validation_error:
- fn: com.gs.transformid: xargs: {success: false, code: 400, message: "shit", data: {req: true}}# on_response_validation_error: #If not explicitly overriden the eventsource config will be used
How will we solve
The text was updated successfully, but these errors were encountered:
The Problem
Sometimes we need to keep multiple versions of the same API in a codebase. This typically involved a different base path for each api like /v1/user/:userid, /v2/user/:userid etc. Currently this is possible in Godspeed via adding this base path in each endpoint separately. It should be able to be done at level of a group of events kept in a folder. this can be done by a custom base_url in each folder.
Similarly, one should be able to setup custom authz, validation_error handlers, middleware per event group stored in a separate folder in
src/events
The Solution
Eventsource -> Event group -> Event
How will we solve
The text was updated successfully, but these errors were encountered: