Commit Graph

346 Commits

Author SHA1 Message Date
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 cb7f22e03d
remove useless readme assets
continuous-integration/drone/push Build is passing Details
2020-03-28 15:45:56 +01:00
Adrien Marquès d3e8d48bc3 Merge branch 'refactor/const-api-errors' of go/aicra into 0.3.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
allow constants for api.Error and update api.Handler signature

- api.EmtyResponse().WithError(api.Error) is the new interface for api.Response
- handlers return an api.Response that is wrapped into the final response
- server.HandleFunc becomes server.Handle
2020-03-28 14:01:08 +00:00
Adrien Marquès af09466013
migrate api.response to const errors; make HandlerFn return an api.Error; rename http HandlFunc to Handle;
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2020-03-28 14:57:28 +01:00
Adrien Marquès 5504e4b3ec
make api errors int; allow for const defaults 2020-03-28 14:51:49 +01:00
Adrien Marquès 2f9534a3b0 Merge branch 'refactor/config-validator' of go/aicra into 0.3.0
continuous-integration/drone/push Build is passing Details
add validator interface to unify and for readability in internal/config
2020-03-28 11:33:34 +00: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 eef94ff998
also check method when finding missing handlers 2020-03-22 16:37:43 +01:00
Adrien Marquès 97cf19d7b4
update readme
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-22 15:03:35 +01:00
Adrien Marquès d57f60c710
set content-type to json before writing response
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-22 14:05:47 +01:00
Adrien Marquès ad6de97979
fix: actually get service handler 2020-03-22 14:05:32 +01:00
Adrien Marquès 2ee48560b6
make ToHTTPServer() check for missing handlers
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
- check for missing handlers in ToHTTPServer()
 - rename HTTP() to ToHTTPServer()
 - remove logs
2020-03-21 16:53:19 +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 d6c22b5ff0
adapt server to previous api changes
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-03-21 14:49:36 +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
Adrien Marquès 3a258400c0
remove api useless errors : UnkonwnMethod and UncallableMethod 2020-03-21 14:19:35 +01:00
Adrien Marquès 9475fe4526
use private errors do avoid overlapping types among packages 2020-03-21 14:19:14 +01:00
Adrien Marquès 3606f9984d
update tests for internal/reqdata set
continuous-integration/drone/push Build is failing Details
2020-03-20 22:36:15 +01:00
Adrien Marquès 7b812c6648
get data from multipart components 2020-03-20 22:35:53 +01:00
Adrien Marquès dc34d9a81a
wrap multipart errors in dedicated error : ErrInvalidMultipart 2020-03-20 22:35:30 +01:00
Adrien Marquès cdbe4cceac
ignore io.EOF while parsing multipart 2020-03-20 22:27:01 +01:00
Adrien Marquès 03d5e87c37
wrap json parser into dedicated error : ErrInvalidJSON 2020-03-20 22:26:43 +01:00
Adrien Marquès c7aa87c660
ignore EOF when parsing form as json 2020-03-20 22:18:34 +01:00
Adrien Marquès 0f62fc25a0
use request.URL.RequestURI() insteaf of request.RequestURI() ; it is not the same 2020-03-20 22:09:38 +01:00
Adrien Marquès 8c539370aa
remove cerr 2020-03-16 12:53:48 +01:00
Adrien Marquès acd0e73438
remove typecheck 2020-03-16 12:53:37 +01:00
Adrien Marquès b38a9a8111
refactor internal/reqdata to work with thew new config 2020-03-16 12:50:30 +01:00
Adrien Marquès 93b31b9718
keep references to Form parameters 2020-03-16 11:48:44 +01:00
Adrien Marquès 12417f7f1c
reference query parameters in config.Service 2020-03-16 11:32:37 +01:00
Adrien Marquès e7f10723a6
check for undefined brace captures + make tests parallel 2020-03-16 10:56:26 +01:00
Adrien Marquès c32b038da2
make splitURL public 2020-03-16 09:26:10 +01:00
Adrien Marquès 1b4922693b
move config -> internal.config and config.datatype to datatype 2020-03-16 09:20:00 +01:00
Adrien Marquès 4e0d669029
make config.Service members public 2020-03-16 09:01:51 +01:00
Adrien Marquès 2c1b9cf5ff
make captures public 2020-03-15 01:38:49 +01:00
Adrien Marquès d1ab4fefb0
add brace captures and check between param and pattern (keep them so no need to check them at each req) 2020-03-15 01:37:28 +01:00
Adrien Marquès 32aff3e07f
bcupdate: add service.Match, parameter.assignDataType, service.matchPattern, server.collide
continuous-integration/drone/push Build is failing Details
- datatype-s are required as arguments in Parse(), datatypes are built into the config parameters
 - collision detection compares : http method, pattern (both fixed, one/both captures)
 - test service.Match(); more to test
 - some refactor and fix tests
2020-03-15 00:27:54 +01:00
Adrien Marquès 6a144a9a93
rename Builder into semantic DataType 2020-03-14 16:16:30 +01:00
Adrien Marquès 511070196b
add validator to service input parameter
continuous-integration/drone/push Build is failing Details
2020-03-14 16:14:04 +01:00