Commit Graph

158 Commits

Author SHA1 Message Date
Adrien Marquès 2b67655cfd
refactor: reduce cyclomatic complexity of service.validateInput()
- simplify matchPattern()
 - rename isMethodAvailable() to checkMethod()
 - rename isPatternValid() to checkPattern()
 - rename validateInput() to checkInput()
 - rename validateOutput() to checkOutput()
 - refactor per-type input param management in new method parseParam(); that returns the param type (added unexported enum) and the error
 - refactor collision detection from checkInput() and checkOutput() in new method nameConflicts()
2021-06-22 22:18:29 +02:00
Adrien Marquès f4f49e6ae6
fix: lint: consistent receiver name 2021-06-22 21:15:25 +02:00
Adrien Marquès ad178781ac
test: cover dynfunc signature to 100% 2021-06-21 22:46:04 +02:00
Adrien Marquès 178d9a8eee
refactor: export config errors 2021-06-21 21:50:57 +02:00
Adrien Marquès 8b92abd1c2 fix: remove debug/typo 2021-06-21 21:38:06 +02:00
Adrien Marquès 8c122e9ddf feat: export dynfunc errors 2021-06-21 21:34:52 +02:00
Adrien Marquès de547576c9
refactor: semantic move 'builtin' into 'validator' 2021-06-21 21:30:33 +02:00
Adrien Marquès defa2c3645
refactor: rename semantics of datatype to validator.Type 2021-06-21 21:08:22 +02:00
Adrien Marquès 822ef823e9
migrate: symbols import paths to github 2021-06-20 21:29:46 +02:00
Adrien Marquès af63c4514b
refactor: idiomatic remove of api.Context for context.Context, custom middlewares for standard http middlewares
continuous-integration/drone/push Build is passing Details
- remove api.Context as using context.Context is more idiomatic
 - remove api.Adapter as it is redundant with func(http.Handler) http.Handler
 - remove authentication middlewares as they be achieved as normal middlewares but launched around the handler (after the service has been found and validated)
 - builder.With() adds an standard Middleware that runs before any aicra code
 - builder.WithContext() adds an http middleware that runs just before the service handler is called. The http.Request provided contains a context with useful values such as the required permissions (from the service configuration).
 - handlers take a context.Context variable as first argument instead of api.Context
2021-06-20 02:14:31 +02:00
Adrien Marquès 53dfc8f679
feat: *api.Context is required as first handler argument
continuous-integration/drone/push Build is passing Details
2021-06-20 00:47:04 +02:00
Adrien Marquès fa1ecfd97f
feat: create internal context.Context custom keys 2021-06-20 00:46:04 +02:00
Adrien Marquès af106acd3f refactor: test: dynamic function handler
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-04-19 23:34:31 +02:00
Adrien Marquès b88a4439c8 fixup: update comment for optional api.Ctx 2021-04-19 22:15:34 +02:00
Adrien Marquès e44dab4bc9 fixup: remove HasContext from spec 2021-04-19 19:55:00 +02:00
Adrien Marquès d6f8457274 feat: pass optional context argument to handlers
continuous-integration/drone/push Build is passing Details
2021-04-18 19:31:54 +02:00
Adrien Marquès 0a55c2ee13 feat: add optional api.Ctx first argument to handler checker 2021-04-18 19:25:31 +02:00
Adrien Marquès 24be7c294e test: dynamic func input 2021-04-18 18:26:37 +02:00
Adrien Marquès a693bbbf9b fix: reflect assign value to pointer of value in call argument
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-04-18 17:55:48 +02:00
Adrien Marquès 10e59acdae
fix: test string-int concatenation warnings 2021-03-28 18:50:25 +02:00
Adrien Marquès 6039fbb41f
update: api.Err system
- rename 'Error' to 'Err'
 - use struct instead of int as underlying type ; remove dependency on 2 maps for reason and HTTP status codes
 - remove useless json implementation
2021-03-28 18:49:23 +02:00
Adrien Marquès 30862195a1
config: refactor, simplify, test, remove redundant comments 2020-04-04 15:39:00 +02:00
Adrien Marquès 990bb86919
rework reqdata api and remove redundant comments 2020-04-04 14:56:15 +02:00
Adrien Marquès 35ede5e266
unexport config errors 2020-04-04 14:34:20 +02:00
Adrien Marquès 90472b8bf7
unexport dynfunc errors 2020-04-04 12:46:43 +02:00
Adrien Marquès df56496a16
dynfunc: normalize file names 2020-04-04 12:45:36 +02:00
Adrien Marquès caa57889b4
multipart: rename files and unexport errors 2020-04-04 12:43:55 +02:00
Adrien Marquès 4ba62e19c7
remove func.go and standardize main file name 2020-04-04 12:42:18 +02:00
Adrien Marquès 5cc3d2d455
use http.Request instead of pointer 2020-04-04 12:03:29 +02:00
Adrien Marquès 09362aad83
make 'dynfunc' internal 2020-04-04 11:49:33 +02:00
Adrien Marquès 1e0fb77d61
standardize and simplify the config package 2020-04-04 11:45:49 +02:00
Adrien Marquès a5424d8941
parse output in internal/config to find the datatype's reflect.Type() 2020-03-29 16:59:32 +02:00
Adrien Marquès 974f58fb8e
parse 'out' for internal config
continuous-integration/drone/push Build is passing Details
2020-03-29 14:18:38 +02:00
Adrien Marquès ca2be1415d
enforce 'name' for capture or query parameters 2020-03-29 14:18:05 +02:00
Adrien Marquès b15bb578ce
delegate from internal.service to parameter.Validate() 2020-03-29 14:12:47 +02:00
Adrien Marquès 76cc2f5279
replace datatype.Kind() with Type() 2020-03-28 19:11:23 +01:00
Adrien Marquès 8cfa2235d6
add Kind() method to datatype.T interface and to config parameter 2020-03-28 18:48:27 +01:00
Adrien Marquès 49cf06d5d8
implement validator interface for config.server; refactor
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2020-03-28 12:31:44 +01:00
Adrien Marquès af3ffa7d6a
implement validator interface for config.service; rename for readability 2020-03-28 12:30:57 +01:00
Adrien Marquès dac9aa4298
implement validator interface for config.parameter 2020-03-28 12:28:58 +01:00
Adrien Marquès 54705b7472
create validator interface for config 2020-03-28 12:26:11 +01:00
Adrien Marquès 5f3aa5967d
provide datatype registry to every type to allow for recursive datatypes : slices, maps, structs 2020-03-22 16:50:10 +01:00
Adrien Marquès a15a5c1f7a
fix: register mismatch when no brace capture
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-21 15:58:05 +01:00
Adrien Marquès 5fe983c486
display both services in pattern collision error messages 2020-03-21 15:57:35 +01:00
Adrien Marquès 3017cc5ba9
add method tests for pattern collision
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-21 15:52:07 +01:00
Adrien Marquès 9c3166397f
add tests for service collision
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-21 15:49:07 +01:00
Adrien Marquès e3adbf48ca
consider collision only if every part is matching 2020-03-21 15:48:59 +01:00
Adrien Marquès 0e6dfbe580
make pattern collission error message explicit
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-21 15:15:33 +01:00
Adrien Marquès 9a5b0dd6e3
remove Parameter type, only keep method parseParameter() 2020-03-21 14:45:39 +01:00
Adrien Marquès 149ec9a9a0
internal/reqdata Parse() does not return errors anymore 2020-03-21 14:20:26 +01:00