Commit Graph

413 Commits

Author SHA1 Message Date
Adrien Marquès 3613581b1c
fix: reqdata checks for missing form input globally for json, multipart, url encoded 2021-06-23 09:12:04 +02:00
Adrien Marquès 90e62b7e72 test: handler top-level errors: service, params 2021-06-22 23:49:03 +02:00
Adrien Marquès 1cc24be254 feat: url encoded parameters (uri + form) are only considered a slice when multiple values are set
- if `?a=123`, "123" is the value that can be validated as string, int, etc
 - if `?a=123&a=456`, the slice []type{123,456} is the value that can be validated as slice of strings, ints, etc.
2021-06-22 23:44:21 +02:00
Adrien Marquès fcc8b39717
fix: ignore uri query for service pattern matching 2021-06-22 22:45:47 +02:00
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 140fbb8b23
fix: gofmt: with -s argument 2021-06-22 21:16:25 +02:00
Adrien Marquès f4f49e6ae6
fix: lint: consistent receiver name 2021-06-22 21:15:25 +02:00
Adrien Marquès c048db76e6
fix: ineffectual assignments 2021-06-22 21:14:38 +02:00
Adrien Marquès ad86a3b46b
fix: mispells 2021-06-22 21:11:59 +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 19bcc2e8dc
test: cover api context 2021-06-21 21:46:03 +02:00
Adrien Marquès 8b92abd1c2 fix: remove debug/typo 2021-06-21 21:38:06 +02:00
Adrien Marquès 89e81617d5 test: cover response 2021-06-21 21:38:06 +02:00
Adrien Marquès cff4106bf5 refactor: unexport api.Response into aicra.response 2021-06-21 21:38:06 +02:00
Adrien Marquès f17622195a test: cover builtin types 2021-06-21 21:38:03 +02:00
Adrien Marquès 461c17299e test: cover builder 2021-06-21 21:35:14 +02:00
Adrien Marquès 8c122e9ddf feat: export dynfunc errors 2021-06-21 21:34:52 +02:00
xdrm-brackets b4a426adcc fix: cover api.Auth 2021-06-21 21:34:52 +02:00
xdrm-brackets 6182276856
Merge pull request #3 from xdrm-io/refactor/validators
refactor: semantic rename and simplify validators
2021-06-21 21:34:17 +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
xdrm-brackets 0ee814abbe
Merge pull request #1 from xdrm-io/migrate/github
Migrate repo to GitHub
2021-06-20 21:51:03 +02:00
Adrien Marquès 36991ea9ef
docs: add build status 2021-06-20 21:49:56 +02:00
Adrien Marquès b3ef7de624
migrate: drone CI to github actions 2021-06-20 21:47:17 +02:00
Adrien Marquès 822ef823e9
migrate: symbols import paths to github 2021-06-20 21:29:46 +02:00
Adrien Marquès 77a1f3b11d Merge pull request 'docs: fix logo asset url to branch 0.4.0' (#26) from fix/readme-asset-url into 0.4.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #26
2021-06-20 08:35:45 +00:00
Adrien Marquès a8d7905180
docs: fix logo asset url to branch 0.4.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-06-20 10:35:08 +02:00
Adrien Marquès cc25995659 Merge pull request 'refactor/idiomatic-handlers-middlewares' (#25) from refactor/idiomatic-handlers-middlewares into 0.4.0
continuous-integration/drone/push Build is passing Details
Reviewed-on: #25
2021-06-20 08:26:27 +00:00
Adrien Marquès fd1ced5a8b
fix: restore request denied on invalid auth after contextual middlwares
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-06-20 10:24:12 +02:00
Adrien Marquès 97941da901
docs: update README for context.Context and middlewares
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-06-20 02:16:24 +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 6a78351a2c
doc: update README for *api.Context handler argument 2021-06-20 00:56:25 +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 ed404106f2
refactor: rename api.Ctx to api.Context, extends context.Context with helper methods 2021-06-20 00:46:42 +02:00
Adrien Marquès fa1ecfd97f
feat: create internal context.Context custom keys 2021-06-20 00:46:04 +02:00
Adrien Marquès 418631e09d Merge branch 'feature/improve-readme' into 0.3.0
continuous-integration/drone/push Build is passing Details
2021-06-19 00:25:01 +02:00
Adrien Marquès 2d87052dda
fix: typos
continuous-integration/drone/push Build is passing Details
2021-06-19 00:24:26 +02:00
Adrien Marquès 610ab66ea8
readme: add logo, improve structure and explanations
continuous-integration/drone/push Build is passing Details
2021-06-19 00:17:37 +02:00
Adrien Marquès 3563d53365 Merge pull request 'feature: dynamic scope using input arguments' (#23) from feature/dynamic-scope into 0.3.0
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
Reviewed-on: #23
2021-05-19 12:06:19 +00:00
xdrm-brackets c35e2fdd9a
fix: do not use optional (nil) inputs for dynamic scope
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 17:45:07 +02:00
xdrm-brackets 8c2ebd916e
feat: add test coverage
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 16:30:20 +02:00
xdrm-brackets 2a17ba2f72
fix: allow non-Stringer using %v format (unsafe but does the job) 2021-05-18 16:24:31 +02:00
xdrm-brackets 346cc4e557
feat: add dynamic scope from request's input
- all occurences of '[abc]' where 'abc' is a valid input name ('name' field from json) is replaced with its value between square brackets
2021-05-18 16:06:49 +02:00
Adrien Marquès 214e2348aa Merge pull request 'feature: authentication middlewares' (#20) from feature/expose-scope into 0.3.0
continuous-integration/drone/push Build is passing Details
Reviewed-on: #20
2021-05-18 13:57:56 +00:00
Adrien Marquès 976b13bd38 Merge pull request 'fix: remove error status from json' (#22) from fix/json-err-status into 0.3.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #22
2021-05-18 09:10:53 +00:00
xdrm-brackets 3bb02fcbb7
fix: remove error status from json
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 11:10:12 +02:00
xdrm-brackets 4a62df8029
feat: handle auth adapters
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 09:59:49 +02:00
xdrm-brackets 4f55302e8a
feat: add WithAuth() to builder using api.AuthAdapter interface 2021-05-18 09:36:33 +02:00
xdrm-brackets 18d809c4ca
feat: create api.Auth wrapping authorization management 2021-05-18 09:34:01 +02:00