LCOV - code coverage report
Current view: top level - io/source/json - json_schema_writer.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.57.0_covts Lines: 0 190 0.0 %
Date: 2024-04-07 11:14:42 Functions: 0 7 0.0 %

          Line data    Source code
       1             : /* File: json_schema_writer.c; Copyright and License: see below */
       2             : 
       3             : #include "json/json_schema_writer.h"
       4             : #include "json/json_constants.h"
       5             : #include "utf8stringbuf/utf8string.h"
       6             : #include "u8/u8_trace.h"
       7             : #include <assert.h>
       8             : 
       9             : static const char SCHEMA_GRAPH_HEADER[]
      10             : =
      11             : "{\n"
      12             : "  \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n"
      13             : "  \"$id\": \"https://localhost/1d0f422c-9c68-4fe4-a295-87bc8e8d080d/crystal-facet-uml.schema.json\",\n"
      14             : "  \"title\": \"crystal-facet-uml model\",\n"
      15             : "  \"description\": \"This schema defines the structure of json objects to store a uml/sysml model.\",\n"
      16             : "  \"type\": \"object\",\n"
      17             : "  \"required\": [\"" JSON_CONSTANTS_KEY_HEAD "\"],\n"
      18             : "  \"properties\":\n"
      19             : "  {\n"
      20             : "    \"" JSON_CONSTANTS_KEY_HEAD "\":\n"
      21             : "    {\n"
      22             : "      \"description\": \"" JSON_CONSTANTS_KEY_HEAD " defines properties of the json file.\",\n"
      23             : "      \"type\": \"object\"\n"
      24             : "    },\n"
      25             : ;
      26             : 
      27             : static const char SCHEMA_GRAPH_VIEWS[]
      28             : =
      29             : "    \"" JSON_CONSTANTS_KEY_VIEWS "\":\n"
      30             : "    {\n"
      31             : "      \"description\": \"" JSON_CONSTANTS_KEY_VIEWS " is an array whose elements describe the views on the model.\",\n"
      32             : "      \"type\": \"array\",\n"
      33             : "      \"items\":\n"
      34             : "      {\n"
      35             : "        \"description\": \"An element of " JSON_CONSTANTS_KEY_VIEWS " is an object that specifies a "
      36             : JSON_CONSTANTS_KEY_DIAGRAM ".\",\n"
      37             : "        \"type\": \"object\",\n"
      38             : "        \"required\": [\"" JSON_CONSTANTS_KEY_DIAGRAM "\"],\n"
      39             : "        \"properties\":\n"
      40             : "        {\n"
      41             : ;
      42             : 
      43             : static const char SCHEMA_DIAGRAM_HEADER[]
      44             : =
      45             : "          \"" JSON_CONSTANTS_KEY_DIAGRAM "\":\n"
      46             : "          {\n"
      47             : "            \"description\": \"" JSON_CONSTANTS_KEY_DIAGRAM " is a view that is specified by listing the nodes to be shown in "
      48             : JSON_CONSTANTS_KEY_DIAGRAM_ELEMENTS ".\",\n"
      49             : "            \"type\": \"object\",\n"
      50             : "            \"properties\":\n"
      51             : "            {\n"
      52             : ;
      53             : 
      54             : static const char SCHEMA_DIAGRAM_ELEMENTS_HEADER[]
      55             : =
      56             : "              \"" JSON_CONSTANTS_KEY_DIAGRAM_ELEMENTS "\":\n"
      57             : "              {\n"
      58             : "                \"description\": \"" JSON_CONSTANTS_KEY_DIAGRAM_ELEMENTS " is the list of elements shown in the diagram.\",\n"
      59             : "                \"type\": \"array\",\n"
      60             : "                \"items\":\n"
      61             : "                {\n"
      62             : "                  \"description\": \"An element of " JSON_CONSTANTS_KEY_DIAGRAM_ELEMENTS " specifies what and how to show.\",\n"
      63             : "                  \"type\": \"object\",\n"
      64             : "                  \"properties\":\n"
      65             : "                  {\n"
      66             : ;
      67             : 
      68             : static const char SCHEMA_DIAGRAM_ELEMENTS_FOOTER[]
      69             : =
      70             : "                  },\n"
      71             : "                  \"additionalProperties\": false\n"
      72             : "                },\n"
      73             : "              }\n"
      74             : ;
      75             : 
      76             : static const char SCHEMA_DIAGRAM_FOOTER[]
      77             : =
      78             : "            },\n"
      79             : "            \"additionalProperties\": false\n"
      80             : "          }\n"
      81             : ;
      82             : 
      83             : static const char SCHEMA_GRAPH_NODES[]
      84             : =
      85             : "        }\n"
      86             : "      }\n"
      87             : "    },\n"
      88             : "    \"" JSON_CONSTANTS_KEY_NODES "\":\n"
      89             : "    {\n"
      90             : "      \"description\": \"" JSON_CONSTANTS_KEY_NODES " is an array whose elements describe the nodes of the model-graph.\",\n"
      91             : "      \"type\": \"array\",\n"
      92             : "      \"items\":\n"
      93             : "      {\n"
      94             : "        \"description\": \"An element of " JSON_CONSTANTS_KEY_NODES " is an object that specifies a "
      95             : JSON_CONSTANTS_KEY_CLASSIFIER ".\",\n"
      96             : "        \"type\": \"object\",\n"
      97             : "        \"required\": [\"" JSON_CONSTANTS_KEY_CLASSIFIER "\"],\n"
      98             : "        \"properties\":\n"
      99             : "        {\n"
     100             : ;
     101             : 
     102             : static const char SCHEMA_CLASSIFIER_HEADER[]
     103             : =
     104             : "          \"" JSON_CONSTANTS_KEY_CLASSIFIER "\":\n"
     105             : "          {\n"
     106             : "            \"description\": \"" JSON_CONSTANTS_KEY_CLASSIFIER " is a node that contains a list of subnodes called " JSON_CONSTANTS_KEY_CLASSIFIER_FEATURES ".\",\n"
     107             : "            \"type\": \"object\",\n"
     108             : "            \"properties\":\n"
     109             : "            {\n"
     110             : ;
     111             : 
     112             : static const char SCHEMA_FEATURES_HEADER[]
     113             : =
     114             : "              \"" JSON_CONSTANTS_KEY_CLASSIFIER_FEATURES "\":\n"
     115             : "              {\n"
     116             : "                \"description\": \"" JSON_CONSTANTS_KEY_CLASSIFIER_FEATURES " is the list of features of the classifier.\",\n"
     117             : "                \"type\": \"array\",\n"
     118             : "                \"items\":\n"
     119             : "                {\n"
     120             : "                  \"description\": \"An element of " JSON_CONSTANTS_KEY_CLASSIFIER_FEATURES " specifies a feature or port or lifeline.\",\n"
     121             : "                  \"type\": \"object\",\n"
     122             : "                  \"properties\":\n"
     123             : "                  {\n"
     124             : ;
     125             : 
     126             : static const char SCHEMA_FEATURES_FOOTER[]
     127             : =
     128             : "                  },\n"
     129             : "                  \"additionalProperties\": false\n"
     130             : "                }\n"
     131             : "              }\n"
     132             : ;
     133             : 
     134             : static const char SCHEMA_CLASSIFIER_FOOTER[]
     135             : =
     136             : "            },\n"
     137             : "            \"additionalProperties\": false\n"
     138             : "          }\n"
     139             : ;
     140             : 
     141             : static const char SCHEMA_GRAPH_EDGES[]
     142             : =
     143             : "        }\n"
     144             : "      }\n"
     145             : "    },\n"
     146             : "    \"" JSON_CONSTANTS_KEY_EDGES "\":\n"
     147             : "    {\n"
     148             : "      \"description\": \"" JSON_CONSTANTS_KEY_EDGES " is an array whose elements describe the edges of the model-graph.\",\n"
     149             : "      \"type\": \"array\",\n"
     150             : "      \"items\":\n"
     151             : "      {\n"
     152             : "        \"description\": \"An element of " JSON_CONSTANTS_KEY_EDGES " is an object that specifies a "
     153             : JSON_CONSTANTS_KEY_RELATIONSHIP ".\",\n"
     154             : "        \"type\": \"object\",\n"
     155             : "        \"required\": [\"" JSON_CONSTANTS_KEY_RELATIONSHIP "\"],\n"
     156             : "        \"properties\":\n"
     157             : "        {\n"
     158             : ;
     159             : 
     160             : static const char SCHEMA_RELATIONSHIP_HEADER[]
     161             : =
     162             : "          \"" JSON_CONSTANTS_KEY_RELATIONSHIP "\":\n"
     163             : "          {\n"
     164             : "            \"description\": \"" JSON_CONSTANTS_KEY_RELATIONSHIP " is an edge with 1 source and 1 destination end.\",\n"
     165             : "            \"type\": \"object\",\n"
     166             : "            \"properties\":\n"
     167             : "            {\n"
     168             : ;
     169             : 
     170             : static const char SCHEMA_RELATIONSHIP_FOOTER[]
     171             : =
     172             : "            },\n"
     173             : "            \"additionalProperties\": false\n"
     174             : "          }\n"
     175             : ;
     176             : 
     177             : static const char SCHEMA_GRAPH_FOOTER[]
     178             : =
     179             : "        }\n"
     180             : "      }\n"
     181             : "    }\n"
     182             : "  }\n"
     183             : "}\n"
     184             : ;
     185             : 
     186             : static const char INDENT_7[] = "              ";
     187             : static const char INDENT_10[] = "                    ";
     188             : 
     189           0 : void json_schema_writer_init ( json_schema_writer_t *this_,
     190             :                                universal_output_stream_t *output )
     191             : {
     192           0 :     U8_TRACE_BEGIN();
     193           0 :     assert( NULL != output );
     194             : 
     195           0 :     utf8stream_writer_init( &((*this_).writer), output );
     196           0 :     (*this_).indent = 7;
     197             : 
     198           0 :     U8_TRACE_END();
     199           0 : }
     200             : 
     201           0 : void json_schema_writer_destroy( json_schema_writer_t *this_ )
     202             : {
     203           0 :     U8_TRACE_BEGIN();
     204             : 
     205           0 :     utf8stream_writer_destroy( &((*this_).writer) );
     206             : 
     207           0 :     U8_TRACE_END();
     208           0 : }
     209             : 
     210           0 : u8_error_t json_schema_writer_write_schema( json_schema_writer_t *this_ )
     211             : {
     212           0 :     U8_TRACE_BEGIN();
     213           0 :     u8_error_t export_err = U8_ERROR_NONE;
     214             : 
     215             :     static const char *const ANY_ID = "id is a proposal, may be changed automatically";
     216             :     static const char *const ANY_UUID = "uuid is an identifier, all letters must be lowercase";
     217             :     static const char *const ANY_STEREO = "stereotype is available since version 1.47.0";
     218             :     static const char *const ANY_DESCR = "a part of the description (to be concatenated)";
     219             :     static const char *const ANY_ORDER
     220             :         = "a value between –2147483648 and 2147483647 by which to order elements in 1 or 2 dimensions";
     221             : 
     222           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_GRAPH_HEADER );
     223           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_GRAPH_VIEWS );
     224           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_DIAGRAM_HEADER );
     225             : 
     226           0 :     (*this_).indent = 7;
     227           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_DIAGRAM_ID, ANY_ID );
     228             :     static const char *const D_PARENT_NAME
     229             :         = "name of " JSON_CONSTANTS_KEY_DIAGRAM_PARENT " diagram, exported for reviews by humans, ignored at import";
     230           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAM_PARENT_NAME, D_PARENT_NAME );
     231             :     static const char *const D_PARENT_ID = "uuid of the parent diagram, omitted by the root diagram";
     232           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_DIAGRAM_PARENT, D_PARENT_ID, true );
     233             :     static const char *const D_DIAGTYPE_ID = "id of diagram type, see source file data/include/data_diagram_type.h";
     234           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_DIAGRAM_DIAGRAM_TYPE, D_DIAGTYPE_ID );
     235             :     static const char *const D_DIAGTYPE_NAME
     236             :         = JSON_CONSTANTS_KEY_DIAGRAM_DIAGRAM_TYPE " as string, exported for reviews by humans, ignored at import";
     237             :     /* TODO: generate an enum listing all options */
     238           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAM_DIAGRAM_TYPE_NAME, D_DIAGTYPE_NAME );
     239           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAM_STEREOTYPE, ANY_STEREO );
     240           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAM_NAME, "" );
     241           0 :     export_err |= json_schema_writer_private_declare_array_of_string( this_, JSON_CONSTANTS_KEY_DIAGRAM_DESCRIPTION, "", ANY_DESCR );
     242           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_DIAGRAM_LIST_ORDER, ANY_ORDER );
     243             :     static const char *const D_FLAGS = "set of flags, see source file data/include/data_diagram_flag.h";
     244           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_DIAGRAM_DISPLAY_FLAGS, D_FLAGS );
     245             :     static const char *const D_FLAG_NAME
     246             :         = JSON_CONSTANTS_KEY_DIAGRAM_DISPLAY_FLAGS " as string, exported for reviews by humans, ignored at import";
     247             :     /* TODO: generate an enum listing all options */
     248           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAM_DISPLAY_FLAG_NAMES, D_FLAG_NAME );
     249           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_UUID, ANY_UUID, true /*elements follow*/ );
     250             : 
     251           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_DIAGRAM_ELEMENTS_HEADER );
     252             : 
     253           0 :     (*this_).indent = 10;
     254           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_DIAGRAMELEMENT_ID, ANY_ID );
     255             :     static const char *const E_NODE_C_NAME
     256             :         = "name of " JSON_CONSTANTS_KEY_DIAGRAMELEMENT_NODE "/classifier, exported for reviews by humans, ignored at import";
     257           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAMELEMENT_CLASSIFIER_NAME, E_NODE_C_NAME );
     258             :     static const char *const E_NODE_F_NAME
     259             :         = "name of " JSON_CONSTANTS_KEY_DIAGRAMELEMENT_NODE "/feature (if lifeline), optional, exported for reviews by humans, ignored at import";
     260           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAMELEMENT_FOCUSED_FEATURE_NAME, E_NODE_F_NAME );
     261             :     static const char *const E_FLAGS = "set of flags, see source file data/include/data_diagramelement_flag.h";
     262           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_DIAGRAMELEMENT_DISPLAY_FLAGS, E_FLAGS );
     263             :     static const char *const E_FLAG_NAME
     264             :         = JSON_CONSTANTS_KEY_DIAGRAMELEMENT_DISPLAY_FLAGS " as string, exported for reviews by humans, ignored at import";
     265             :     /* TODO: generate an enum listing all options */
     266           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_DIAGRAMELEMENT_DISPLAY_FLAG_NAMES, E_FLAG_NAME );
     267             :     static const char *const E_NODE = "the uuid of either the classifier or the feature (type lifeline only)";
     268           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_DIAGRAMELEMENT_NODE, E_NODE, true );
     269           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_UUID, ANY_UUID, false );
     270             : 
     271           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_DIAGRAM_ELEMENTS_FOOTER );
     272           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_DIAGRAM_FOOTER );
     273           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_GRAPH_NODES );
     274           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_CLASSIFIER_HEADER );
     275             : 
     276           0 :     (*this_).indent = 7;
     277           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_CLASSIFIER_ID, ANY_ID );
     278             :     static const char *const C_TYPE_ID = "id of classifier type, see source file data/include/data_classifier_type.h";
     279           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_CLASSIFIER_MAIN_TYPE, C_TYPE_ID );
     280             :     static const char *const C_TYPE_NAME
     281             :         = "name of " JSON_CONSTANTS_KEY_CLASSIFIER_MAIN_TYPE ", exported for reviews by humans, ignored at import";
     282             :     /* TODO: generate an enum listing all options */
     283           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_CLASSIFIER_MAIN_TYPE_NAME, C_TYPE_NAME );
     284           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_CLASSIFIER_STEREOTYPE, "" );
     285           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_CLASSIFIER_NAME, "" );
     286           0 :     export_err |= json_schema_writer_private_declare_array_of_string( this_, JSON_CONSTANTS_KEY_CLASSIFIER_DESCRIPTION, "", ANY_DESCR );
     287           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_CLASSIFIER_X_ORDER, ANY_ORDER );
     288           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_CLASSIFIER_Y_ORDER, ANY_ORDER );
     289           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_CLASSIFIER_LIST_ORDER, ANY_ORDER );
     290           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_UUID, ANY_UUID, true /*features follow*/ );
     291             : 
     292           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_FEATURES_HEADER );
     293             : 
     294           0 :     (*this_).indent = 10;
     295           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_FEATURE_ID, ANY_ID );
     296             :     static const char *const F_TYPE_ID = "id of feature type, see source file data/include/data_feature_type.h";
     297           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_FEATURE_MAIN_TYPE, F_TYPE_ID );
     298             :     static const char *const F_TYPE_NAME
     299             :         = "name of " JSON_CONSTANTS_KEY_FEATURE_MAIN_TYPE ", exported for reviews by humans, ignored at import";
     300             :     /* TODO: generate an enum listing all options */
     301           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_FEATURE_MAIN_TYPE_NAME, F_TYPE_NAME );
     302           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_FEATURE_KEY, "name" );
     303             :     static const char *const F_VALUE = "valuetype in case of properties, value in case of tagges values, stereotype otherwise";
     304           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_FEATURE_VALUE, F_VALUE );
     305           0 :     export_err |= json_schema_writer_private_declare_array_of_string( this_, JSON_CONSTANTS_KEY_FEATURE_DESCRIPTION, "", ANY_DESCR );
     306           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_FEATURE_LIST_ORDER, ANY_ORDER );
     307           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_UUID, ANY_UUID, false );
     308             : 
     309           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_FEATURES_FOOTER );
     310           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_CLASSIFIER_FOOTER );
     311           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_GRAPH_EDGES );
     312           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_RELATIONSHIP_HEADER );
     313             : 
     314           0 :     (*this_).indent = 7;
     315           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_ID, ANY_ID );
     316             :     static const char *const R_TYPE_ID = "id of relationship type, see source file data/include/data_relationship_type.h";
     317           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_MAIN_TYPE, R_TYPE_ID );
     318             :     static const char *const R_TYPE_NAME
     319             :         = "name of " JSON_CONSTANTS_KEY_RELATIONSHIP_MAIN_TYPE ", exported for reviews by humans, ignored at import";
     320             :     /* TODO: generate an enum listing all options */
     321           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_MAIN_TYPE_NAME, R_TYPE_NAME );
     322           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_STEREOTYPE, ANY_STEREO );
     323           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_NAME, "" );
     324           0 :     export_err |= json_schema_writer_private_declare_array_of_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_DESCRIPTION, "", ANY_DESCR );
     325           0 :     export_err |= json_schema_writer_private_declare_integer( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_LIST_ORDER, ANY_ORDER );
     326             :     static const char *const E_FROM_NODE_C_NAME
     327             :         = "name of " JSON_CONSTANTS_KEY_RELATIONSHIP_FROM_NODE "/classifier, exported for reviews by humans, ignored at import";
     328           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_FROM_CLASSIFIER_NAME, E_FROM_NODE_C_NAME );
     329             :     static const char *const E_FROM_NODE_F_NAME
     330             :         = "key of " JSON_CONSTANTS_KEY_RELATIONSHIP_FROM_NODE "/feature if applicable, exported for reviews by humans, ignored at import";
     331           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_FROM_FEATURE_KEY, E_FROM_NODE_F_NAME );
     332             :     static const char *const E_FROM_NODE = "the uuid of the source: either the classifier or the feature";
     333           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_FROM_NODE, E_FROM_NODE, true );
     334             :     static const char *const E_TO_NODE_C_NAME
     335             :         = "name of " JSON_CONSTANTS_KEY_RELATIONSHIP_TO_NODE "/classifier, exported for reviews by humans, ignored at import";
     336           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_TO_CLASSIFIER_NAME, E_TO_NODE_C_NAME );
     337             :     static const char *const E_TO_NODE_F_NAME
     338             :         = "key of " JSON_CONSTANTS_KEY_RELATIONSHIP_TO_NODE "/feature if applicable, exported for reviews by humans, ignored at import";
     339           0 :     export_err |= json_schema_writer_private_declare_string( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_TO_FEATURE_KEY, E_TO_NODE_F_NAME );
     340             :     static const char *const E_TO_NODE = "the uuid of the destination: either the classifier or the feature";
     341           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_RELATIONSHIP_TO_NODE, E_TO_NODE, true );
     342           0 :     export_err |= json_schema_writer_private_declare_uuid( this_, JSON_CONSTANTS_KEY_UUID, ANY_UUID, false );
     343             : 
     344           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_RELATIONSHIP_FOOTER );
     345           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), SCHEMA_GRAPH_FOOTER );
     346             : 
     347           0 :     export_err |= utf8stream_writer_flush( &((*this_).writer) );
     348             : 
     349           0 :     U8_TRACE_END_ERR( export_err );
     350           0 :     return export_err;
     351             : }
     352             : 
     353           0 : u8_error_t json_schema_writer_private_declare_integer( json_schema_writer_t *this_,
     354             :                                                        const char* name,
     355             :                                                        const char* description )
     356             : {
     357           0 :     U8_TRACE_BEGIN();
     358           0 :     assert( name != NULL );
     359           0 :     assert( description != NULL );
     360           0 :     u8_error_t export_err = U8_ERROR_NONE;
     361           0 :     const char *const indent = ((*this_).indent==10) ? INDENT_10 : INDENT_7;
     362             : 
     363           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     364           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\"" );
     365           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), name );
     366           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\":\n" );
     367             : 
     368           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     369           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "{\n" );
     370             : 
     371           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     372           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"description\": \"" );
     373           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), description );
     374           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\",\n" );
     375             : 
     376           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     377           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"type\": \"number\"\n" );
     378             : 
     379           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     380           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "},\n" );
     381             : 
     382           0 :     U8_TRACE_END_ERR( export_err );
     383           0 :     return export_err;
     384             : }
     385             : 
     386           0 : u8_error_t json_schema_writer_private_declare_string( json_schema_writer_t *this_,
     387             :                                                       const char* name,
     388             :                                                       const char* description )
     389             : {
     390           0 :     U8_TRACE_BEGIN();
     391           0 :     assert( name != NULL );
     392           0 :     assert( description != NULL );
     393           0 :     u8_error_t export_err = U8_ERROR_NONE;
     394           0 :     const char *const indent = ((*this_).indent==10) ? INDENT_10 : INDENT_7;
     395             : 
     396           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     397           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\"" );
     398           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), name );
     399           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\":\n" );
     400             : 
     401           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     402           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "{\n" );
     403             : 
     404           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     405           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"description\": \"" );
     406           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), description );
     407           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\",\n" );
     408             : 
     409           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     410           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"type\": \"string\"\n" );
     411             : 
     412           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     413           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "},\n" );
     414             : 
     415           0 :     U8_TRACE_END_ERR( export_err );
     416           0 :     return export_err;
     417             : }
     418             : 
     419           0 : u8_error_t json_schema_writer_private_declare_array_of_string( json_schema_writer_t *this_,
     420             :                                                                const char* name,
     421             :                                                                const char* description,
     422             :                                                                const char* element_description )
     423             : {
     424           0 :     U8_TRACE_BEGIN();
     425           0 :     assert( name != NULL );
     426           0 :     assert( description != NULL );
     427           0 :     assert( element_description != NULL );
     428           0 :     u8_error_t export_err = U8_ERROR_NONE;
     429           0 :     const char *const indent = ((*this_).indent==10) ? INDENT_10 : INDENT_7;
     430             : 
     431           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent  );
     432           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\"" );
     433           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), name );
     434           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\":\n" );
     435             : 
     436           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     437           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "{\n" );
     438             : 
     439           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     440           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"description\": \"" );
     441           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), description );
     442           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\",\n" );
     443             : 
     444           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     445           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"type\": \"array\",\n" );
     446             : 
     447           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     448           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"items\":\n" );
     449             : 
     450           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     451           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  {\n" );
     452             : 
     453           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     454           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "    \"description\": \"" );
     455           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), element_description );
     456           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\",\n" );
     457             : 
     458           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     459           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "    \"type\": \"string\"\n" );
     460             : 
     461           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     462           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  }\n" );
     463             : 
     464             : 
     465           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     466           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "},\n");
     467             : 
     468           0 :     U8_TRACE_END_ERR( export_err );
     469           0 :     return export_err;
     470             : }
     471             : 
     472           0 : u8_error_t json_schema_writer_private_declare_uuid( json_schema_writer_t *this_,
     473             :                                                     const char* name,
     474             :                                                     const char* description,
     475             :                                                     bool has_next )
     476             : {
     477           0 :     U8_TRACE_BEGIN();
     478           0 :     assert( name != NULL );
     479           0 :     assert( description != NULL );
     480           0 :     u8_error_t export_err = U8_ERROR_NONE;
     481           0 :     const char *const indent = ((*this_).indent==10) ? INDENT_10 : INDENT_7;
     482             : 
     483           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     484           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\"" );
     485           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), name );
     486           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\":\n" );
     487             : 
     488           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     489           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "{\n" );
     490             : 
     491           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     492           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"description\": \"" );
     493           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), description );
     494           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "\",\n" );
     495             : 
     496           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     497           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), "  \"type\": \"string\"\n" );
     498             : 
     499           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), indent );
     500           0 :     export_err |= utf8stream_writer_write_str( &((*this_).writer), has_next ? "},\n" : "}\n" );
     501             : 
     502           0 :     U8_TRACE_END_ERR( export_err );
     503           0 :     return export_err;
     504             : }
     505             : 
     506             : 
     507             : /*
     508             : Copyright 2023-2024 Andreas Warnke
     509             : 
     510             : Licensed under the Apache License, Version 2.0 (the "License");
     511             : you may not use this file except in compliance with the License.
     512             : You may obtain a copy of the License at
     513             : 
     514             :     http://www.apache.org/licenses/LICENSE-2.0
     515             : 
     516             : Unless required by applicable law or agreed to in writing, software
     517             : distributed under the License is distributed on an "AS IS" BASIS,
     518             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     519             : See the License for the specific language governing permissions and
     520             : limitations under the License.
     521             : */

Generated by: LCOV version 1.16