Skip to content
Snippets Groups Projects
Commit 4ec1b9e5 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Minor changes to the JSON default upgrade (issue #547)


Signed-off-by: default avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 7c187762
No related branches found
No related tags found
1 merge request!166JSON dec: implemented the 'default' attribute defined in the standard CR 7968 (issue #547)
......@@ -3833,6 +3833,8 @@ void Type::generate_json_schema(JSON_Tokenizer& json, bool embedded, bool as_val
}
// insert default value (if any)
// todo: this prints a TTCN-3 value's string representation in case it's a standard-compliant
// default attribute, and not a legacy one...
if (jsonattrib != NULL && jsonattrib->default_value.str != NULL) {
json.put_next_token(JSON_TOKEN_NAME, "default");
switch (last->typetype) {
......
......@@ -86,7 +86,7 @@ typedef struct {
boolean jsonOmitAsNull;
boolean jsonMetainfoUnbound;
const char* jsonAlias;
const char* jsonDefaultValue;
const char* jsonDefaultValue; // legacy default value
rawAST_coding_taglist_list* jsonChosen;
/** true if the field is a record-of or set-of with optimized memory allocation */
boolean optimizedMemAlloc;
......
......@@ -62,6 +62,7 @@ JsonAST::JsonAST(const JsonAST *other_val)
default_value.type = other_val->default_value.type;
default_value.str = (NULL != other_val->default_value.str) ? mcopystr(other_val->default_value.str) : NULL;
default_value.val = (NULL != other_val->default_value.val) ? other_val->default_value.val->clone() : NULL;
default_value.loc = (NULL != other_val->default_value.loc) ? new Common::Location(*other_val->default_value.loc) : NULL;
as_number = other_val->as_number;
for (size_t i = 0; i < other_val->schema_extensions.size(); ++i) {
schema_extensions.add(new JsonSchemaExtension(*other_val->schema_extensions[i]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment