Test case
1 generated file · +1 −1test/inputs/json/misc/26c9c.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -235,7 +235,7 @@ struct TopLevel { | ||
| 235 | 235 | struct Meta * meta; |
| 236 | 236 | }; |
| 237 | 237 | |
| 238 | -#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 238 | +#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 239 | 239 | struct Datum * cJSON_GetDatumValue(const cJSON * j); |
| 240 | 240 | cJSON * cJSON_CreateDatum(const struct Datum * x); |
| 241 | 241 | void cJSON_DeleteDatum(struct Datum * x); |
Test case
1 generated file · +1 −1test/inputs/json/misc/421d4.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -162,7 +162,7 @@ struct TopLevel { | ||
| 162 | 162 | struct Meta * meta; |
| 163 | 163 | }; |
| 164 | 164 | |
| 165 | -#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 165 | +#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 166 | 166 | struct Datum * cJSON_GetDatumValue(const cJSON * j); |
| 167 | 167 | cJSON * cJSON_CreateDatum(const struct Datum * x); |
| 168 | 168 | void cJSON_DeleteDatum(struct Datum * x); |
Test case
1 generated file · +1 −1test/inputs/json/misc/5f7fe.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -240,7 +240,7 @@ struct TopLevel { | ||
| 240 | 240 | enum TypeName cJSON_GetTypeNameValue(const cJSON * j); |
| 241 | 241 | cJSON * cJSON_CreateTypeName(const enum TypeName x); |
| 242 | 242 | |
| 243 | -#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 243 | +#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 244 | 244 | struct Datum * cJSON_GetDatumValue(const cJSON * j); |
| 245 | 245 | cJSON * cJSON_CreateDatum(const struct Datum * x); |
| 246 | 246 | void cJSON_DeleteDatum(struct Datum * x); |
Test case
1 generated file · +1 −1test/inputs/json/misc/617e8.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -239,7 +239,7 @@ struct TopLevel { | ||
| 239 | 239 | enum TypeName cJSON_GetTypeNameValue(const cJSON * j); |
| 240 | 240 | cJSON * cJSON_CreateTypeName(const enum TypeName x); |
| 241 | 241 | |
| 242 | -#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 242 | +#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 243 | 243 | struct Datum * cJSON_GetDatumValue(const cJSON * j); |
| 244 | 244 | cJSON * cJSON_CreateDatum(const struct Datum * x); |
| 245 | 245 | void cJSON_DeleteDatum(struct Datum * x); |
Test case
1 generated file · +1 −1test/inputs/json/misc/a0496.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -69,7 +69,7 @@ struct TopLevel { | ||
| 69 | 69 | char * urlize_name; |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | -#define cJSON_IsDatum(j) (cJSON_IsNumber(j) || cJSON_IsString(j)) | |
| 72 | +#define cJSON_IsDatum(j) (cJSON_IsNumber(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 73 | 73 | struct Datum * cJSON_GetDatumValue(const cJSON * j); |
| 74 | 74 | cJSON * cJSON_CreateDatum(const struct Datum * x); |
| 75 | 75 | void cJSON_DeleteDatum(struct Datum * x); |
Test case
1 generated file · +1 −1test/inputs/json/misc/a3d8c.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -168,7 +168,7 @@ struct TopLevel { | ||
| 168 | 168 | enum TypeName cJSON_GetTypeNameValue(const cJSON * j); |
| 169 | 169 | cJSON * cJSON_CreateTypeName(const enum TypeName x); |
| 170 | 170 | |
| 171 | -#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 171 | +#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 172 | 172 | struct Datum * cJSON_GetDatumValue(const cJSON * j); |
| 173 | 173 | cJSON * cJSON_CreateDatum(const struct Datum * x); |
| 174 | 174 | void cJSON_DeleteDatum(struct Datum * x); |
Test case
1 generated file · +1 −1test/inputs/json/misc/fcca3.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -265,7 +265,7 @@ struct TopLevel { | ||
| 265 | 265 | enum TypeName cJSON_GetTypeNameValue(const cJSON * j); |
| 266 | 266 | cJSON * cJSON_CreateTypeName(const enum TypeName x); |
| 267 | 267 | |
| 268 | -#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 268 | +#define cJSON_IsDatum(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 269 | 269 | struct Datum * cJSON_GetDatumValue(const cJSON * j); |
| 270 | 270 | cJSON * cJSON_CreateDatum(const struct Datum * x); |
| 271 | 271 | void cJSON_DeleteDatum(struct Datum * x); |
Test case
2 generated files · +20 −20test/inputs/json/priority/combinations4.json
Mcjsondefault / TopLevel.h+10 −10
| @@ -847,7 +847,7 @@ void cJSON_DeletePyodermiaElement(struct PyodermiaElement * x); | ||
| 847 | 847 | struct PyodermiaElement * cJSON_ParsePyodermiaElement(const char * s); |
| 848 | 848 | char * cJSON_PrintPyodermiaElement(const struct PyodermiaElement * x); |
| 849 | 849 | |
| 850 | -#define cJSON_IsQuebrachineElement(j) (cJSON_IsBool(j) || cJSON_IsObject(j)) | |
| 850 | +#define cJSON_IsQuebrachineElement(j) (cJSON_IsBool(j) || cJSON_IsObject(j) || cJSON_IsNull(j)) | |
| 851 | 851 | struct QuebrachineElement * cJSON_GetQuebrachineElementValue(const cJSON * j); |
| 852 | 852 | cJSON * cJSON_CreateQuebrachineElement(const struct QuebrachineElement * x); |
| 853 | 853 | void cJSON_DeleteQuebrachineElement(struct QuebrachineElement * x); |
| @@ -889,7 +889,7 @@ void cJSON_DeleteRewriteElement(struct RewriteElement * x); | ||
| 889 | 889 | struct RewriteElement * cJSON_ParseRewriteElement(const char * s); |
| 890 | 890 | char * cJSON_PrintRewriteElement(const struct RewriteElement * x); |
| 891 | 891 | |
| 892 | -#define cJSON_IsSaccoderm(j) (cJSON_IsArray(j) || cJSON_IsString(j)) | |
| 892 | +#define cJSON_IsSaccoderm(j) (cJSON_IsArray(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 893 | 893 | struct Saccoderm * cJSON_GetSaccodermValue(const cJSON * j); |
| 894 | 894 | cJSON * cJSON_CreateSaccoderm(const struct Saccoderm * x); |
| 895 | 895 | void cJSON_DeleteSaccoderm(struct Saccoderm * x); |
| @@ -903,7 +903,7 @@ void cJSON_DeleteSantirElement(struct SantirElement * x); | ||
| 903 | 903 | struct SantirElement * cJSON_ParseSantirElement(const char * s); |
| 904 | 904 | char * cJSON_PrintSantirElement(const struct SantirElement * x); |
| 905 | 905 | |
| 906 | -#define cJSON_IsSaprophilous(j) (cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 906 | +#define cJSON_IsSaprophilous(j) (cJSON_IsObject(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 907 | 907 | struct Saprophilous * cJSON_GetSaprophilousValue(const cJSON * j); |
| 908 | 908 | cJSON * cJSON_CreateSaprophilous(const struct Saprophilous * x); |
| 909 | 909 | void cJSON_DeleteSaprophilous(struct Saprophilous * x); |
| @@ -917,14 +917,14 @@ void cJSON_DeleteSaxtenElement(struct SaxtenElement * x); | ||
| 917 | 917 | struct SaxtenElement * cJSON_ParseSaxtenElement(const char * s); |
| 918 | 918 | char * cJSON_PrintSaxtenElement(const struct SaxtenElement * x); |
| 919 | 919 | |
| 920 | -#define cJSON_IsScoffer(j) (cJSON_IsArray(j) || cJSON_IsObject(j)) | |
| 920 | +#define cJSON_IsScoffer(j) (cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsNull(j)) | |
| 921 | 921 | struct Scoffer * cJSON_GetScofferValue(const cJSON * j); |
| 922 | 922 | cJSON * cJSON_CreateScoffer(const struct Scoffer * x); |
| 923 | 923 | void cJSON_DeleteScoffer(struct Scoffer * x); |
| 924 | 924 | struct Scoffer * cJSON_ParseScoffer(const char * s); |
| 925 | 925 | char * cJSON_PrintScoffer(const struct Scoffer * x); |
| 926 | 926 | |
| 927 | -#define cJSON_IsScrampum(j) (cJSON_IsArray(j) || cJSON_IsBool(j)) | |
| 927 | +#define cJSON_IsScrampum(j) (cJSON_IsArray(j) || cJSON_IsBool(j) || cJSON_IsNull(j)) | |
| 928 | 928 | struct Scrampum * cJSON_GetScrampumValue(const cJSON * j); |
| 929 | 929 | cJSON * cJSON_CreateScrampum(const struct Scrampum * x); |
| 930 | 930 | void cJSON_DeleteScrampum(struct Scrampum * x); |
| @@ -987,7 +987,7 @@ void cJSON_DeleteTabaxir(struct Tabaxir * x); | ||
| 987 | 987 | struct Tabaxir * cJSON_ParseTabaxir(const char * s); |
| 988 | 988 | char * cJSON_PrintTabaxir(const struct Tabaxir * x); |
| 989 | 989 | |
| 990 | -#define cJSON_IsTalpiform(j) (cJSON_IsObject(j) || cJSON_IsNumber(j)) | |
| 990 | +#define cJSON_IsTalpiform(j) (cJSON_IsObject(j) || cJSON_IsNumber(j) || cJSON_IsNull(j)) | |
| 991 | 991 | struct Talpiform * cJSON_GetTalpiformValue(const cJSON * j); |
| 992 | 992 | cJSON * cJSON_CreateTalpiform(const struct Talpiform * x); |
| 993 | 993 | void cJSON_DeleteTalpiform(struct Talpiform * x); |
| @@ -1036,7 +1036,7 @@ void cJSON_DeleteUnerasing(struct Unerasing * x); | ||
| 1036 | 1036 | struct Unerasing * cJSON_ParseUnerasing(const char * s); |
| 1037 | 1037 | char * cJSON_PrintUnerasing(const struct Unerasing * x); |
| 1038 | 1038 | |
| 1039 | -#define cJSON_IsUnguentarium(j) (cJSON_IsArray(j) || quicktype_cJSON_IsInteger(j)) | |
| 1039 | +#define cJSON_IsUnguentarium(j) (cJSON_IsArray(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j)) | |
| 1040 | 1040 | struct Unguentarium * cJSON_GetUnguentariumValue(const cJSON * j); |
| 1041 | 1041 | cJSON * cJSON_CreateUnguentarium(const struct Unguentarium * x); |
| 1042 | 1042 | void cJSON_DeleteUnguentarium(struct Unguentarium * x); |
| @@ -1050,14 +1050,14 @@ void cJSON_DeleteUnimpeachablyElement(struct UnimpeachablyElement * x); | ||
| 1050 | 1050 | struct UnimpeachablyElement * cJSON_ParseUnimpeachablyElement(const char * s); |
| 1051 | 1051 | char * cJSON_PrintUnimpeachablyElement(const struct UnimpeachablyElement * x); |
| 1052 | 1052 | |
| 1053 | -#define cJSON_IsUnmortgaged(j) (cJSON_IsNumber(j) || cJSON_IsObject(j)) | |
| 1053 | +#define cJSON_IsUnmortgaged(j) (cJSON_IsNumber(j) || cJSON_IsObject(j) || cJSON_IsNull(j)) | |
| 1054 | 1054 | struct Unmortgaged * cJSON_GetUnmortgagedValue(const cJSON * j); |
| 1055 | 1055 | cJSON * cJSON_CreateUnmortgaged(const struct Unmortgaged * x); |
| 1056 | 1056 | void cJSON_DeleteUnmortgaged(struct Unmortgaged * x); |
| 1057 | 1057 | struct Unmortgaged * cJSON_ParseUnmortgaged(const char * s); |
| 1058 | 1058 | char * cJSON_PrintUnmortgaged(const struct Unmortgaged * x); |
| 1059 | 1059 | |
| 1060 | -#define cJSON_IsUnobstructed(j) (cJSON_IsObject(j) || quicktype_cJSON_IsInteger(j)) | |
| 1060 | +#define cJSON_IsUnobstructed(j) (cJSON_IsObject(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j)) | |
| 1061 | 1061 | struct Unobstructed * cJSON_GetUnobstructedValue(const cJSON * j); |
| 1062 | 1062 | cJSON * cJSON_CreateUnobstructed(const struct Unobstructed * x); |
| 1063 | 1063 | void cJSON_DeleteUnobstructed(struct Unobstructed * x); |
| @@ -1099,7 +1099,7 @@ void cJSON_DeleteUnvarying(struct Unvarying * x); | ||
| 1099 | 1099 | struct Unvarying * cJSON_ParseUnvarying(const char * s); |
| 1100 | 1100 | char * cJSON_PrintUnvarying(const struct Unvarying * x); |
| 1101 | 1101 | |
| 1102 | -#define cJSON_IsVehemently(j) (cJSON_IsArray(j) || cJSON_IsBool(j)) | |
| 1102 | +#define cJSON_IsVehemently(j) (cJSON_IsArray(j) || cJSON_IsBool(j) || cJSON_IsNull(j)) | |
| 1103 | 1103 | struct Vehemently * cJSON_GetVehementlyValue(const cJSON * j); |
| 1104 | 1104 | cJSON * cJSON_CreateVehemently(const struct Vehemently * x); |
| 1105 | 1105 | void cJSON_DeleteVehemently(struct Vehemently * x); |
Mcjsonheader-only-false__source-style-single-source--491b617045b9 / TopLevel.h+10 −10
| @@ -847,7 +847,7 @@ void cJSON_DeletePyodermiaElement(struct PyodermiaElement * x); | ||
| 847 | 847 | struct PyodermiaElement * cJSON_ParsePyodermiaElement(const char * s); |
| 848 | 848 | char * cJSON_PrintPyodermiaElement(const struct PyodermiaElement * x); |
| 849 | 849 | |
| 850 | -#define cJSON_IsQuebrachineElement(j) (cJSON_IsBool(j) || cJSON_IsObject(j)) | |
| 850 | +#define cJSON_IsQuebrachineElement(j) (cJSON_IsBool(j) || cJSON_IsObject(j) || cJSON_IsNull(j)) | |
| 851 | 851 | struct QuebrachineElement * cJSON_GetQuebrachineElementValue(const cJSON * j); |
| 852 | 852 | cJSON * cJSON_CreateQuebrachineElement(const struct QuebrachineElement * x); |
| 853 | 853 | void cJSON_DeleteQuebrachineElement(struct QuebrachineElement * x); |
| @@ -889,7 +889,7 @@ void cJSON_DeleteRewriteElement(struct RewriteElement * x); | ||
| 889 | 889 | struct RewriteElement * cJSON_ParseRewriteElement(const char * s); |
| 890 | 890 | char * cJSON_PrintRewriteElement(const struct RewriteElement * x); |
| 891 | 891 | |
| 892 | -#define cJSON_IsSaccoderm(j) (cJSON_IsArray(j) || cJSON_IsString(j)) | |
| 892 | +#define cJSON_IsSaccoderm(j) (cJSON_IsArray(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 893 | 893 | struct Saccoderm * cJSON_GetSaccodermValue(const cJSON * j); |
| 894 | 894 | cJSON * cJSON_CreateSaccoderm(const struct Saccoderm * x); |
| 895 | 895 | void cJSON_DeleteSaccoderm(struct Saccoderm * x); |
| @@ -903,7 +903,7 @@ void cJSON_DeleteSantirElement(struct SantirElement * x); | ||
| 903 | 903 | struct SantirElement * cJSON_ParseSantirElement(const char * s); |
| 904 | 904 | char * cJSON_PrintSantirElement(const struct SantirElement * x); |
| 905 | 905 | |
| 906 | -#define cJSON_IsSaprophilous(j) (cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 906 | +#define cJSON_IsSaprophilous(j) (cJSON_IsObject(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 907 | 907 | struct Saprophilous * cJSON_GetSaprophilousValue(const cJSON * j); |
| 908 | 908 | cJSON * cJSON_CreateSaprophilous(const struct Saprophilous * x); |
| 909 | 909 | void cJSON_DeleteSaprophilous(struct Saprophilous * x); |
| @@ -917,14 +917,14 @@ void cJSON_DeleteSaxtenElement(struct SaxtenElement * x); | ||
| 917 | 917 | struct SaxtenElement * cJSON_ParseSaxtenElement(const char * s); |
| 918 | 918 | char * cJSON_PrintSaxtenElement(const struct SaxtenElement * x); |
| 919 | 919 | |
| 920 | -#define cJSON_IsScoffer(j) (cJSON_IsArray(j) || cJSON_IsObject(j)) | |
| 920 | +#define cJSON_IsScoffer(j) (cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsNull(j)) | |
| 921 | 921 | struct Scoffer * cJSON_GetScofferValue(const cJSON * j); |
| 922 | 922 | cJSON * cJSON_CreateScoffer(const struct Scoffer * x); |
| 923 | 923 | void cJSON_DeleteScoffer(struct Scoffer * x); |
| 924 | 924 | struct Scoffer * cJSON_ParseScoffer(const char * s); |
| 925 | 925 | char * cJSON_PrintScoffer(const struct Scoffer * x); |
| 926 | 926 | |
| 927 | -#define cJSON_IsScrampum(j) (cJSON_IsArray(j) || cJSON_IsBool(j)) | |
| 927 | +#define cJSON_IsScrampum(j) (cJSON_IsArray(j) || cJSON_IsBool(j) || cJSON_IsNull(j)) | |
| 928 | 928 | struct Scrampum * cJSON_GetScrampumValue(const cJSON * j); |
| 929 | 929 | cJSON * cJSON_CreateScrampum(const struct Scrampum * x); |
| 930 | 930 | void cJSON_DeleteScrampum(struct Scrampum * x); |
| @@ -987,7 +987,7 @@ void cJSON_DeleteTabaxir(struct Tabaxir * x); | ||
| 987 | 987 | struct Tabaxir * cJSON_ParseTabaxir(const char * s); |
| 988 | 988 | char * cJSON_PrintTabaxir(const struct Tabaxir * x); |
| 989 | 989 | |
| 990 | -#define cJSON_IsTalpiform(j) (cJSON_IsObject(j) || cJSON_IsNumber(j)) | |
| 990 | +#define cJSON_IsTalpiform(j) (cJSON_IsObject(j) || cJSON_IsNumber(j) || cJSON_IsNull(j)) | |
| 991 | 991 | struct Talpiform * cJSON_GetTalpiformValue(const cJSON * j); |
| 992 | 992 | cJSON * cJSON_CreateTalpiform(const struct Talpiform * x); |
| 993 | 993 | void cJSON_DeleteTalpiform(struct Talpiform * x); |
| @@ -1036,7 +1036,7 @@ void cJSON_DeleteUnerasing(struct Unerasing * x); | ||
| 1036 | 1036 | struct Unerasing * cJSON_ParseUnerasing(const char * s); |
| 1037 | 1037 | char * cJSON_PrintUnerasing(const struct Unerasing * x); |
| 1038 | 1038 | |
| 1039 | -#define cJSON_IsUnguentarium(j) (cJSON_IsArray(j) || quicktype_cJSON_IsInteger(j)) | |
| 1039 | +#define cJSON_IsUnguentarium(j) (cJSON_IsArray(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j)) | |
| 1040 | 1040 | struct Unguentarium * cJSON_GetUnguentariumValue(const cJSON * j); |
| 1041 | 1041 | cJSON * cJSON_CreateUnguentarium(const struct Unguentarium * x); |
| 1042 | 1042 | void cJSON_DeleteUnguentarium(struct Unguentarium * x); |
| @@ -1050,14 +1050,14 @@ void cJSON_DeleteUnimpeachablyElement(struct UnimpeachablyElement * x); | ||
| 1050 | 1050 | struct UnimpeachablyElement * cJSON_ParseUnimpeachablyElement(const char * s); |
| 1051 | 1051 | char * cJSON_PrintUnimpeachablyElement(const struct UnimpeachablyElement * x); |
| 1052 | 1052 | |
| 1053 | -#define cJSON_IsUnmortgaged(j) (cJSON_IsNumber(j) || cJSON_IsObject(j)) | |
| 1053 | +#define cJSON_IsUnmortgaged(j) (cJSON_IsNumber(j) || cJSON_IsObject(j) || cJSON_IsNull(j)) | |
| 1054 | 1054 | struct Unmortgaged * cJSON_GetUnmortgagedValue(const cJSON * j); |
| 1055 | 1055 | cJSON * cJSON_CreateUnmortgaged(const struct Unmortgaged * x); |
| 1056 | 1056 | void cJSON_DeleteUnmortgaged(struct Unmortgaged * x); |
| 1057 | 1057 | struct Unmortgaged * cJSON_ParseUnmortgaged(const char * s); |
| 1058 | 1058 | char * cJSON_PrintUnmortgaged(const struct Unmortgaged * x); |
| 1059 | 1059 | |
| 1060 | -#define cJSON_IsUnobstructed(j) (cJSON_IsObject(j) || quicktype_cJSON_IsInteger(j)) | |
| 1060 | +#define cJSON_IsUnobstructed(j) (cJSON_IsObject(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j)) | |
| 1061 | 1061 | struct Unobstructed * cJSON_GetUnobstructedValue(const cJSON * j); |
| 1062 | 1062 | cJSON * cJSON_CreateUnobstructed(const struct Unobstructed * x); |
| 1063 | 1063 | void cJSON_DeleteUnobstructed(struct Unobstructed * x); |
| @@ -1099,7 +1099,7 @@ void cJSON_DeleteUnvarying(struct Unvarying * x); | ||
| 1099 | 1099 | struct Unvarying * cJSON_ParseUnvarying(const char * s); |
| 1100 | 1100 | char * cJSON_PrintUnvarying(const struct Unvarying * x); |
| 1101 | 1101 | |
| 1102 | -#define cJSON_IsVehemently(j) (cJSON_IsArray(j) || cJSON_IsBool(j)) | |
| 1102 | +#define cJSON_IsVehemently(j) (cJSON_IsArray(j) || cJSON_IsBool(j) || cJSON_IsNull(j)) | |
| 1103 | 1103 | struct Vehemently * cJSON_GetVehementlyValue(const cJSON * j); |
| 1104 | 1104 | cJSON * cJSON_CreateVehemently(const struct Vehemently * x); |
| 1105 | 1105 | void cJSON_DeleteVehemently(struct Vehemently * x); |
Test case
1 generated file · +1 −1test/inputs/json/priority/php-mixed-union.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -56,7 +56,7 @@ struct TopLevel { | ||
| 56 | 56 | list_t * mixed; |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | -#define cJSON_IsMixedElement(j) (cJSON_IsBool(j) || cJSON_IsObject(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 59 | +#define cJSON_IsMixedElement(j) (cJSON_IsBool(j) || cJSON_IsObject(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 60 | 60 | struct MixedElement * cJSON_GetMixedElementValue(const cJSON * j); |
| 61 | 61 | cJSON * cJSON_CreateMixedElement(const struct MixedElement * x); |
| 62 | 62 | void cJSON_DeleteMixedElement(struct MixedElement * x); |
Test case
1 generated file · +1 −1test/inputs/json/priority/unions.json
Mcjsondefault / TopLevel.h+1 −1
| @@ -65,7 +65,7 @@ struct TopLevel { | ||
| 65 | 65 | list_t * z; |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | -#define cJSON_IsX(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsString(j)) | |
| 68 | +#define cJSON_IsX(j) (quicktype_cJSON_IsInteger(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 69 | 69 | struct X * cJSON_GetXValue(const cJSON * j); |
| 70 | 70 | cJSON * cJSON_CreateX(const struct X * x); |
| 71 | 71 | void cJSON_DeleteX(struct X * x); |
Test case
2 generated files · +397 −0test/inputs/schema/direct-union.schema
Aschema-cjsondefault / TopLevel.c+312 −0
| @@ -0,0 +1,312 @@ | ||
| 1 | +/** | |
| 2 | + * TopLevel.c | |
| 3 | + * This file has been autogenerated using quicktype https://github.com/quicktype/quicktype - DO NOT EDIT | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#include "TopLevel.h" | |
| 7 | + | |
| 8 | +struct Anything * cJSON_GetAnythingValue(const cJSON * j) { | |
| 9 | + struct Anything * x = cJSON_malloc(sizeof(struct Anything)); | |
| 10 | + if (NULL != x) { | |
| 11 | + memset(x, 0, sizeof(struct Anything)); | |
| 12 | + if (cJSON_IsNull(j)) { | |
| 13 | + x->type = cJSON_NULL; | |
| 14 | + } | |
| 15 | + else if (cJSON_IsNumber(j)) { | |
| 16 | + x->type = cJSON_Number; | |
| 17 | + x->value.number = cJSON_GetNumberValue(j); | |
| 18 | + } | |
| 19 | + else if (quicktype_cJSON_IsInteger(j)) { | |
| 20 | + x->type = cJSON_Integer; | |
| 21 | + x->value.integer = cJSON_GetNumberValue(j); | |
| 22 | + } | |
| 23 | + else if (cJSON_IsBool(j)) { | |
| 24 | + x->type = cJSON_Bool; | |
| 25 | + x->value.boolean = cJSON_IsTrue(j); | |
| 26 | + } | |
| 27 | + else if (cJSON_IsString(j)) { | |
| 28 | + x->type = cJSON_String; | |
| 29 | + x->value.string = strdup(cJSON_GetStringValue(j)); | |
| 30 | + } | |
| 31 | + else if (cJSON_IsArray(j)) { | |
| 32 | + x->type = cJSON_Array; | |
| 33 | + list_t * x1 = list_create(false, NULL); | |
| 34 | + if (NULL != x1) { | |
| 35 | + cJSON * e1 = NULL; | |
| 36 | + cJSON_ArrayForEach(e1, j) { | |
| 37 | + list_add_tail(x1, quicktype_cJSON_Duplicate(e1), sizeof(cJSON *)); | |
| 38 | + } | |
| 39 | + x->value.anything_array = x1; | |
| 40 | + } | |
| 41 | + } | |
| 42 | + else if (cJSON_IsObject(j)) { | |
| 43 | + x->type = cJSON_Map; | |
| 44 | + hashtable_t * x1 = hashtable_create(64, false); | |
| 45 | + if (NULL != x1) { | |
| 46 | + cJSON * e1 = NULL; | |
| 47 | + cJSON_ArrayForEach(e1, j) { | |
| 48 | + hashtable_add(x1, e1->string, quicktype_cJSON_Duplicate(e1), sizeof(cJSON *)); | |
| 49 | + } | |
| 50 | + x->value.anything_map = x1; | |
| 51 | + } | |
| 52 | + } | |
| 53 | + if (0 == x->type) { cJSON_free(x); return NULL; } | |
| 54 | + } | |
| 55 | + return x; | |
| 56 | +} | |
| 57 | +struct Anything * cJSON_ParseAnything(const char * s) { cJSON * j = cJSON_Parse(s); struct Anything * x = j ? cJSON_GetAnythingValue(j) : NULL; cJSON_Delete(j); return x; } | |
| 58 | +char * cJSON_PrintAnything(const struct Anything * x) { cJSON * j = cJSON_CreateAnything(x); char * s = j ? cJSON_Print(j) : NULL; cJSON_Delete(j); return s; } | |
| 59 | + | |
| 60 | +cJSON * cJSON_CreateAnything(const struct Anything * x) { | |
| 61 | + cJSON * j = NULL; | |
| 62 | + if (NULL != x) { | |
| 63 | + if (cJSON_NULL == x->type) { | |
| 64 | + j = cJSON_CreateNull(); | |
| 65 | + } | |
| 66 | + else if (cJSON_Number == x->type) { | |
| 67 | + j = cJSON_CreateNumber(x->value.number); | |
| 68 | + } | |
| 69 | + else if (cJSON_Integer == x->type) { | |
| 70 | + j = cJSON_CreateNumber(x->value.integer); | |
| 71 | + } | |
| 72 | + else if (cJSON_Bool == x->type) { | |
| 73 | + j = cJSON_CreateBool(x->value.boolean); | |
| 74 | + } | |
| 75 | + else if (cJSON_String == x->type) { | |
| 76 | + j = cJSON_CreateString(x->value.string); | |
| 77 | + } | |
| 78 | + else if (cJSON_Array == x->type) { | |
| 79 | + cJSON * j1 = cJSON_CreateArray(); | |
| 80 | + if (NULL != j1) { | |
| 81 | + cJSON * x1 = list_get_head(x->value.anything_array); | |
| 82 | + while (NULL != x1) { | |
| 83 | + cJSON_AddItemToArray(j1, quicktype_cJSON_Duplicate(x1)); | |
| 84 | + x1 = list_get_next(x->value.anything_array); | |
| 85 | + } | |
| 86 | + j = j1; | |
| 87 | + } | |
| 88 | + } | |
| 89 | + else if (cJSON_Map == x->type) { | |
| 90 | + cJSON * j1 = cJSON_CreateObject(); | |
| 91 | + if (NULL != j1) { | |
| 92 | + char **keys1 = NULL; | |
| 93 | + size_t count1 = hashtable_get_keys(x->value.anything_map, &keys1); | |
| 94 | + if (NULL != keys1) { | |
| 95 | + for (size_t index1 = 0; index1 < count1; index1++) { | |
| 96 | + cJSON *x1 = hashtable_lookup(x->value.anything_map, keys1[index1]); | |
| 97 | + cJSON_AddItemToObject(j1, keys1[index1], quicktype_cJSON_Duplicate(x1)); | |
| 98 | + } | |
| 99 | + cJSON_free(keys1); | |
| 100 | + } | |
| 101 | + j = j1; | |
| 102 | + } | |
| 103 | + } | |
| 104 | + } | |
| 105 | + return j; | |
| 106 | +} | |
| 107 | + | |
| 108 | +void cJSON_DeleteAnything(struct Anything * x) { | |
| 109 | + if (NULL != x) { | |
| 110 | + if (cJSON_Number == x->type) { | |
| 111 | + } | |
| 112 | + else if (cJSON_Integer == x->type) { | |
| 113 | + } | |
| 114 | + else if (cJSON_Bool == x->type) { | |
| 115 | + } | |
| 116 | + else if (cJSON_String == x->type) { | |
| 117 | + cJSON_free(x->value.string); | |
| 118 | + } | |
| 119 | + else if (cJSON_Array == x->type) { | |
| 120 | + if (NULL != x->value.anything_array) { | |
| 121 | + cJSON * x1 = list_get_head(x->value.anything_array); | |
| 122 | + while (NULL != x1) { | |
| 123 | + cJSON_Delete(x1); | |
| 124 | + x1 = list_get_next(x->value.anything_array); | |
| 125 | + } | |
| 126 | + list_release(x->value.anything_array); | |
| 127 | + } | |
| 128 | + } | |
| 129 | + else if (cJSON_Map == x->type) { | |
| 130 | + if (NULL != x->value.anything_map) { | |
| 131 | + char **keys1 = NULL; | |
| 132 | + size_t count1 = hashtable_get_keys(x->value.anything_map, &keys1); | |
| 133 | + if (NULL != keys1) { | |
| 134 | + for (size_t index1 = 0; index1 < count1; index1++) { | |
| 135 | + cJSON *x1 = hashtable_lookup(x->value.anything_map, keys1[index1]); | |
| 136 | + if (NULL != x1) { | |
| 137 | + cJSON_Delete(x1); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + cJSON_free(keys1); | |
| 141 | + } | |
| 142 | + hashtable_release(x->value.anything_map); | |
| 143 | + } | |
| 144 | + } | |
| 145 | + cJSON_free(x); | |
| 146 | + } | |
| 147 | +} | |
| 148 | + | |
| 149 | +struct Thing * cJSON_ParseThing(const char * s) { | |
| 150 | + struct Thing * x = NULL; | |
| 151 | + if (NULL != s) { | |
| 152 | + cJSON * j = cJSON_Parse(s); | |
| 153 | + if (NULL != j) { | |
| 154 | + x = cJSON_GetThingValue(j); | |
| 155 | + cJSON_Delete(j); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + return x; | |
| 159 | +} | |
| 160 | + | |
| 161 | +struct Thing * cJSON_GetThingValue(const cJSON * j) { | |
| 162 | + struct Thing * x = NULL; | |
| 163 | + if (NULL != j) { | |
| 164 | + if (NULL != (x = cJSON_malloc(sizeof(struct Thing)))) { | |
| 165 | + memset(x, 0, sizeof(struct Thing)); | |
| 166 | + if (cJSON_HasObjectItem(j, "optional")) { | |
| 167 | + if (!cJSON_IsAnything(cJSON_GetObjectItemCaseSensitive(j, "optional"))) { cJSON_DeleteThing(x); return NULL; } | |
| 168 | + x->optional = cJSON_GetAnythingValue(cJSON_GetObjectItemCaseSensitive(j, "optional")); | |
| 169 | + if (NULL == x->optional) { cJSON_DeleteThing(x); return NULL; } | |
| 170 | + } | |
| 171 | + if (!cJSON_HasObjectItem(j, "required")) { cJSON_DeleteThing(x); return NULL; } | |
| 172 | + if (cJSON_HasObjectItem(j, "required")) { | |
| 173 | + if (!cJSON_IsAnything(cJSON_GetObjectItemCaseSensitive(j, "required"))) { cJSON_DeleteThing(x); return NULL; } | |
| 174 | + x->required = cJSON_GetAnythingValue(cJSON_GetObjectItemCaseSensitive(j, "required")); | |
| 175 | + if (NULL == x->required) { cJSON_DeleteThing(x); return NULL; } | |
| 176 | + } | |
| 177 | + } | |
| 178 | + } | |
| 179 | + return x; | |
| 180 | +} | |
| 181 | + | |
| 182 | +cJSON * cJSON_CreateThing(const struct Thing * x) { | |
| 183 | + cJSON * j = NULL; | |
| 184 | + if (NULL != x) { | |
| 185 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 186 | + if (NULL != x->optional) { | |
| 187 | + cJSON_AddItemToObject(j, "optional", cJSON_CreateAnything(x->optional)); | |
| 188 | + } | |
| 189 | + cJSON_AddItemToObject(j, "required", cJSON_CreateAnything(x->required)); | |
| 190 | + } | |
| 191 | + } | |
| 192 | + return j; | |
| 193 | +} | |
| 194 | + | |
| 195 | +char * cJSON_PrintThing(const struct Thing * x) { | |
| 196 | + char * s = NULL; | |
| 197 | + if (NULL != x) { | |
| 198 | + cJSON * j = cJSON_CreateThing(x); | |
| 199 | + if (NULL != j) { | |
| 200 | + s = cJSON_Print(j); | |
| 201 | + cJSON_Delete(j); | |
| 202 | + } | |
| 203 | + } | |
| 204 | + return s; | |
| 205 | +} | |
| 206 | + | |
| 207 | +void cJSON_DeleteThing(struct Thing * x) { | |
| 208 | + if (NULL != x) { | |
| 209 | + if (NULL != x->optional) { | |
| 210 | + cJSON_DeleteAnything(x->optional); | |
| 211 | + } | |
| 212 | + if (NULL != x->required) { | |
| 213 | + cJSON_DeleteAnything(x->required); | |
| 214 | + } | |
| 215 | + cJSON_free(x); | |
| 216 | + } | |
| 217 | +} | |
| 218 | + | |
| 219 | +struct TopLevel * cJSON_ParseTopLevel(const char * s) { | |
| 220 | + struct TopLevel * x = NULL; | |
| 221 | + if (NULL != s) { | |
| 222 | + cJSON * j = cJSON_Parse(s); | |
| 223 | + if (NULL != j) { | |
| 224 | + x = cJSON_GetTopLevelValue(j); | |
| 225 | + cJSON_Delete(j); | |
| 226 | + } | |
| 227 | + } | |
| 228 | + return x; | |
| 229 | +} | |
| 230 | + | |
| 231 | +struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j) { | |
| 232 | + struct TopLevel * x = NULL; | |
| 233 | + if (NULL != j) { | |
| 234 | + if (NULL != (x = cJSON_malloc(sizeof(struct TopLevel)))) { | |
| 235 | + memset(x, 0, sizeof(struct TopLevel)); | |
| 236 | + if (!cJSON_HasObjectItem(j, "stuff")) { cJSON_DeleteTopLevel(x); return NULL; } | |
| 237 | + if (cJSON_HasObjectItem(j, "stuff")) { | |
| 238 | + if (!cJSON_IsObject(cJSON_GetObjectItemCaseSensitive(j, "stuff"))) { cJSON_DeleteTopLevel(x); return NULL; } | |
| 239 | + hashtable_t * x1 = hashtable_create(64, false); | |
| 240 | + if (NULL != x1) { | |
| 241 | + cJSON * e1 = NULL; | |
| 242 | + cJSON * j1 = cJSON_GetObjectItemCaseSensitive(j, "stuff"); | |
| 243 | + cJSON_ArrayForEach(e1, j1) { | |
| 244 | + if (!cJSON_IsObject(e1)) { cJSON_DeleteTopLevel(x); return NULL; } | |
| 245 | + hashtable_add(x1, e1->string, cJSON_GetThingValue(e1), sizeof(struct Thing *)); | |
| 246 | + } | |
| 247 | + x->stuff = x1; | |
| 248 | + } | |
| 249 | + } | |
| 250 | + else { | |
| 251 | + x->stuff = hashtable_create(64, false); | |
| 252 | + } | |
| 253 | + } | |
| 254 | + } | |
| 255 | + return x; | |
| 256 | +} | |
| 257 | + | |
| 258 | +cJSON * cJSON_CreateTopLevel(const struct TopLevel * x) { | |
| 259 | + cJSON * j = NULL; | |
| 260 | + if (NULL != x) { | |
| 261 | + if (NULL != (j = cJSON_CreateObject())) { | |
| 262 | + if (NULL != x->stuff) { | |
| 263 | + cJSON * j1 = cJSON_CreateObject(); | |
| 264 | + if (NULL != j1) { | |
| 265 | + char **keys1 = NULL; | |
| 266 | + size_t count1 = hashtable_get_keys(x->stuff, &keys1); | |
| 267 | + if (NULL != keys1) { | |
| 268 | + for (size_t index1 = 0; index1 < count1; index1++) { | |
| 269 | + struct Thing *x1 = hashtable_lookup(x->stuff, keys1[index1]); | |
| 270 | + cJSON_AddItemToObject(j1, keys1[index1], cJSON_CreateThing(x1)); | |
| 271 | + } | |
| 272 | + cJSON_free(keys1); | |
| 273 | + } | |
| 274 | + cJSON_AddItemToObject(j, "stuff", j1); | |
| 275 | + } | |
| 276 | + } | |
| 277 | + } | |
| 278 | + } | |
| 279 | + return j; | |
| 280 | +} | |
| 281 | + | |
| 282 | +char * cJSON_PrintTopLevel(const struct TopLevel * x) { | |
| 283 | + char * s = NULL; | |
| 284 | + if (NULL != x) { | |
| 285 | + cJSON * j = cJSON_CreateTopLevel(x); | |
| 286 | + if (NULL != j) { | |
| 287 | + s = cJSON_Print(j); | |
| 288 | + cJSON_Delete(j); | |
| 289 | + } | |
| 290 | + } | |
| 291 | + return s; | |
| 292 | +} | |
| 293 | + | |
| 294 | +void cJSON_DeleteTopLevel(struct TopLevel * x) { | |
| 295 | + if (NULL != x) { | |
| 296 | + if (NULL != x->stuff) { | |
| 297 | + char **keys1 = NULL; | |
| 298 | + size_t count1 = hashtable_get_keys(x->stuff, &keys1); | |
| 299 | + if (NULL != keys1) { | |
| 300 | + for (size_t index1 = 0; index1 < count1; index1++) { | |
| 301 | + struct Thing *x1 = hashtable_lookup(x->stuff, keys1[index1]); | |
| 302 | + if (NULL != x1) { | |
| 303 | + cJSON_DeleteThing(x1); | |
| 304 | + } | |
| 305 | + } | |
| 306 | + cJSON_free(keys1); | |
| 307 | + } | |
| 308 | + hashtable_release(x->stuff); | |
| 309 | + } | |
| 310 | + cJSON_free(x); | |
| 311 | + } | |
| 312 | +} |
Aschema-cjsondefault / TopLevel.h+85 −0
| @@ -0,0 +1,85 @@ | ||
| 1 | +/** | |
| 2 | + * TopLevel.h | |
| 3 | + * This file has been autogenerated using quicktype https://github.com/quicktype/quicktype - DO NOT EDIT | |
| 4 | + * This file depends of https://github.com/DaveGamble/cJSON, https://github.com/joelguittet/c-list and https://github.com/joelguittet/c-hashtable | |
| 5 | + * To parse json data from json string use the following: struct <type> * data = cJSON_Parse<type>(<string>); | |
| 6 | + * To get json data from cJSON object use the following: struct <type> * data = cJSON_Get<type>Value(<cjson>); | |
| 7 | + * To get cJSON object from json data use the following: cJSON * cjson = cJSON_Create<type>(<data>); | |
| 8 | + * To print json string from json data use the following: char * string = cJSON_Print<type>(<data>); | |
| 9 | + * To delete json data use the following: cJSON_Delete<type>(<data>); | |
| 10 | + */ | |
| 11 | + | |
| 12 | +#ifndef __TOPLEVEL_H__ | |
| 13 | +#define __TOPLEVEL_H__ | |
| 14 | + | |
| 15 | +#ifdef __cplusplus | |
| 16 | +extern "C" { | |
| 17 | +#endif | |
| 18 | + | |
| 19 | +#include <stdint.h> | |
| 20 | +#include <stdbool.h> | |
| 21 | +#include <stdlib.h> | |
| 22 | +#include <string.h> | |
| 23 | +#include <regex.h> | |
| 24 | +#include <cJSON.h> | |
| 25 | +#include <hashtable.h> | |
| 26 | +#include <list.h> | |
| 27 | + | |
| 28 | +#define quicktype_cJSON_Duplicate(j) cJSON_Duplicate(j, true) | |
| 29 | +#define cJSON_Integer (1 << 18) | |
| 30 | +#define quicktype_cJSON_IsInteger(j) (cJSON_IsNumber(j) && (j)->valuedouble == (int64_t)(j)->valuedouble) | |
| 31 | +#ifndef cJSON_Bool | |
| 32 | +#define cJSON_Bool (cJSON_True | cJSON_False) | |
| 33 | +#endif | |
| 34 | +#ifndef cJSON_Map | |
| 35 | +#define cJSON_Map (1 << 16) | |
| 36 | +#endif | |
| 37 | +#ifndef cJSON_Enum | |
| 38 | +#define cJSON_Enum (1 << 17) | |
| 39 | +#endif | |
| 40 | + | |
| 41 | +struct Anything { | |
| 42 | + int type; | |
| 43 | + union { | |
| 44 | + double number; | |
| 45 | + int64_t integer; | |
| 46 | + bool boolean; | |
| 47 | + char * string; | |
| 48 | + list_t * anything_array; | |
| 49 | + hashtable_t * anything_map; | |
| 50 | + } value; | |
| 51 | +}; | |
| 52 | + | |
| 53 | +struct Thing { | |
| 54 | + struct Anything * optional; | |
| 55 | + struct Anything * required; | |
| 56 | +}; | |
| 57 | + | |
| 58 | +struct TopLevel { | |
| 59 | + hashtable_t * stuff; | |
| 60 | +}; | |
| 61 | + | |
| 62 | +#define cJSON_IsAnything(j) (cJSON_IsNull(j) || cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsString(j) || cJSON_IsArray(j) || cJSON_IsObject(j)) | |
| 63 | +struct Anything * cJSON_GetAnythingValue(const cJSON * j); | |
| 64 | +cJSON * cJSON_CreateAnything(const struct Anything * x); | |
| 65 | +void cJSON_DeleteAnything(struct Anything * x); | |
| 66 | +struct Anything * cJSON_ParseAnything(const char * s); | |
| 67 | +char * cJSON_PrintAnything(const struct Anything * x); | |
| 68 | + | |
| 69 | +struct Thing * cJSON_ParseThing(const char * s); | |
| 70 | +struct Thing * cJSON_GetThingValue(const cJSON * j); | |
| 71 | +cJSON * cJSON_CreateThing(const struct Thing * x); | |
| 72 | +char * cJSON_PrintThing(const struct Thing * x); | |
| 73 | +void cJSON_DeleteThing(struct Thing * x); | |
| 74 | + | |
| 75 | +struct TopLevel * cJSON_ParseTopLevel(const char * s); | |
| 76 | +struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j); | |
| 77 | +cJSON * cJSON_CreateTopLevel(const struct TopLevel * x); | |
| 78 | +char * cJSON_PrintTopLevel(const struct TopLevel * x); | |
| 79 | +void cJSON_DeleteTopLevel(struct TopLevel * x); | |
| 80 | + | |
| 81 | +#ifdef __cplusplus | |
| 82 | +} | |
| 83 | +#endif | |
| 84 | + | |
| 85 | +#endif /* __TOPLEVEL_H__ */ |
Test case
1 generated file · +4 −4test/inputs/schema/recursive-union-flattening.schema
Mschema-cjsondefault / TopLevel.h+4 −4
| @@ -96,28 +96,28 @@ struct TopLevel { | ||
| 96 | 96 | } value; |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | -#define cJSON_IsX(j) (cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 99 | +#define cJSON_IsX(j) (cJSON_IsNull(j) || cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 100 | 100 | struct X * cJSON_GetXValue(const cJSON * j); |
| 101 | 101 | cJSON * cJSON_CreateX(const struct X * x); |
| 102 | 102 | void cJSON_DeleteX(struct X * x); |
| 103 | 103 | struct X * cJSON_ParseX(const char * s); |
| 104 | 104 | char * cJSON_PrintX(const struct X * x); |
| 105 | 105 | |
| 106 | -#define cJSON_IsXElement(j) (cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 106 | +#define cJSON_IsXElement(j) (cJSON_IsNull(j) || cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 107 | 107 | struct XElement * cJSON_GetXElementValue(const cJSON * j); |
| 108 | 108 | cJSON * cJSON_CreateXElement(const struct XElement * x); |
| 109 | 109 | void cJSON_DeleteXElement(struct XElement * x); |
| 110 | 110 | struct XElement * cJSON_ParseXElement(const char * s); |
| 111 | 111 | char * cJSON_PrintXElement(const struct XElement * x); |
| 112 | 112 | |
| 113 | -#define cJSON_IsTopLevelElement(j) (cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 113 | +#define cJSON_IsTopLevelElement(j) (cJSON_IsNull(j) || cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsArray(j) || cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 114 | 114 | struct TopLevelElement * cJSON_GetTopLevelElementValue(const cJSON * j); |
| 115 | 115 | cJSON * cJSON_CreateTopLevelElement(const struct TopLevelElement * x); |
| 116 | 116 | void cJSON_DeleteTopLevelElement(struct TopLevelElement * x); |
| 117 | 117 | struct TopLevelElement * cJSON_ParseTopLevelElement(const char * s); |
| 118 | 118 | char * cJSON_PrintTopLevelElement(const struct TopLevelElement * x); |
| 119 | 119 | |
| 120 | -#define cJSON_IsTopLevel(j) (cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsString(j) || cJSON_IsArray(j) || cJSON_IsObject(j)) | |
| 120 | +#define cJSON_IsTopLevel(j) (cJSON_IsNull(j) || cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsString(j) || cJSON_IsArray(j) || cJSON_IsObject(j)) | |
| 121 | 121 | struct TopLevel * cJSON_GetTopLevelValue(const cJSON * j); |
| 122 | 122 | cJSON * cJSON_CreateTopLevel(const struct TopLevel * x); |
| 123 | 123 | void cJSON_DeleteTopLevel(struct TopLevel * x); |
Test case
1 generated file · +1 −1test/inputs/schema/rust-cycle-breaker-union.schema
Mschema-cjsondefault / TopLevel.h+1 −1
| @@ -58,7 +58,7 @@ struct TopLevel { | ||
| 58 | 58 | char * value; |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | -#define cJSON_IsNext(j) (cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 61 | +#define cJSON_IsNext(j) (cJSON_IsObject(j) || cJSON_IsNull(j) || cJSON_IsString(j)) | |
| 62 | 62 | struct Next * cJSON_GetNextValue(const cJSON * j); |
| 63 | 63 | cJSON * cJSON_CreateNext(const struct Next * x); |
| 64 | 64 | void cJSON_DeleteNext(struct Next * x); |
Test case
1 generated file · +1 −1test/inputs/schema/unevaluated-properties.schema
Mschema-cjsondefault / TopLevel.h+1 −1
| @@ -68,7 +68,7 @@ struct TopLevel { | ||
| 68 | 68 | struct Config * config; |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | -#define cJSON_IsClosed(j) (cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsString(j) || cJSON_IsArray(j) || cJSON_IsObject(j)) | |
| 71 | +#define cJSON_IsClosed(j) (cJSON_IsNull(j) || cJSON_IsNumber(j) || quicktype_cJSON_IsInteger(j) || cJSON_IsBool(j) || cJSON_IsString(j) || cJSON_IsArray(j) || cJSON_IsObject(j)) | |
| 72 | 72 | struct Closed * cJSON_GetClosedValue(const cJSON * j); |
| 73 | 73 | cJSON * cJSON_CreateClosed(const struct Closed * x); |
| 74 | 74 | void cJSON_DeleteClosed(struct Closed * x); |
Test case
1 generated file · +2 −2test/inputs/schema/vega-lite.schema
Mschema-cjsondefault / TopLevel.h+2 −2
| @@ -6542,7 +6542,7 @@ void cJSON_DeleteEqual(struct Equal * x); | ||
| 6542 | 6542 | struct Equal * cJSON_ParseEqual(const char * s); |
| 6543 | 6543 | char * cJSON_PrintEqual(const struct Equal * x); |
| 6544 | 6544 | |
| 6545 | -#define cJSON_IsRangeElement(j) (cJSON_IsNumber(j) || cJSON_IsObject(j)) | |
| 6545 | +#define cJSON_IsRangeElement(j) (cJSON_IsNumber(j) || cJSON_IsObject(j) || cJSON_IsNull(j)) | |
| 6546 | 6546 | struct RangeElement * cJSON_GetRangeElementValue(const cJSON * j); |
| 6547 | 6547 | cJSON * cJSON_CreateRangeElement(const struct RangeElement * x); |
| 6548 | 6548 | void cJSON_DeleteRangeElement(struct RangeElement * x); |
| @@ -6612,7 +6612,7 @@ void cJSON_DeleteScheme(struct Scheme * x); | ||
| 6612 | 6612 | struct Scheme * cJSON_ParseScheme(const char * s); |
| 6613 | 6613 | char * cJSON_PrintScheme(const struct Scheme * x); |
| 6614 | 6614 | |
| 6615 | -#define cJSON_IsSortUnion(j) (cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 6615 | +#define cJSON_IsSortUnion(j) (cJSON_IsNull(j) || cJSON_IsObject(j) || cJSON_IsString(j)) | |
| 6616 | 6616 | struct SortUnion * cJSON_GetSortUnionValue(const cJSON * j); |
| 6617 | 6617 | cJSON * cJSON_CreateSortUnion(const struct SortUnion * x); |
| 6618 | 6618 | void cJSON_DeleteSortUnion(struct SortUnion * x); |
No generated files match these filters.