Skip to content
Snippets Groups Projects
Commit 986e950f authored by Jakob Olsson's avatar Jakob Olsson
Browse files

add small poc code

parent cd22a85d
No related branches found
No related tags found
No related merge requests found
CC = g++
CFLAGS = -g -Wall -std=c++11
LIBS = -ljson-c -ljsonschema-c -ljson-validator -ljson-schema-validator
OBJS = test.o
SRCS = test.c
ISRCS = test.h
all: test
test: ${OBJS}
${CC} ${LDFLAGS} -o test ${OBJS} ${LIBS}
clean:
rm -f test *.o
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <json-c/json.h>
#include <json-validator.h>
int main(int argc, char *argv[])
{
struct json_object *obj = json_tokener_parse(
"{\
\"test\": \"s\"\
}"
);
struct json_object *sch = json_tokener_parse(
"{\
\"$schema\": \"http://json-schema.org/draft-07/schema#\",\
\"$id\": \"http://example.com/root.json\",\
\"type\": \"object\",\
\"title\": \"The Root Schema\",\
\"required\": [\
\"test\"\
],\
\"properties\": {\
\"test\": {\
\"type\": \"integer\",\
\"title\": \"The Test Schema\",\
\"default\": 0,\
\"examples\": [\
5\
]\
}\
}\
}"
);
int rv = json_object_validate_schema(obj, sch);
printf("rv = %d\n", rv);
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment