diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-06-16 18:13:53 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-06-16 18:13:53 +0200 |
| commit | 3a88e6f18243b399979fe03ea6e1d51d931cabfe (patch) | |
| tree | ee19d668e64579070cd0389e710bc7e5f41c2ecb /src/server_internal.h | |
| parent | 297a44c08675f4b7744081963248e9e3552850e7 (diff) | |
| download | ffwd-3a88e6f18243b399979fe03ea6e1d51d931cabfe.tar.gz ffwd-3a88e6f18243b399979fe03ea6e1d51d931cabfe.zip | |
server: extract JSON validation and error bodies into server_json.c
Diffstat (limited to 'src/server_internal.h')
| -rw-r--r-- | src/server_internal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/server_internal.h b/src/server_internal.h index 9aaa5d8..9de8ca8 100644 --- a/src/server_internal.h +++ b/src/server_internal.h @@ -21,6 +21,7 @@ #include "deps/ae/ae.h" +#include <cjson/cJSON.h> #include <pthread.h> #include <stdbool.h> #include <stddef.h> @@ -233,4 +234,17 @@ struct job { job *next; }; +/* ---- server_json.c: request validation and error bodies ---- */ +void append_json_string(sbuf *b, const char *s); +char *json_error_body(const char *message, const char *type, size_t *len); +void job_set_error(job *j, int status, const char *message, const char *type); +bool ve_add(cJSON *detail, const char *loc_json, const char *msg, const char *type); +void job_set_422(job *j, cJSON *detail); +cJSON *parse_json_body(job *j, cJSON *detail); +bool cjson_is_integer(cJSON *item); +const char *encoding_from_root(cJSON *root, cJSON *detail, embedding_api_t api); +int text_type_is_query(cJSON *root, cJSON *detail, const char *query_instruct); +int dimensions_from_root( + cJSON *root, cJSON *detail, int min_dim, int max_dim, const char *encoding); + #endif /* EMBED_SERVER_INTERNAL_H */ |
