Warning, /pim/libkgapi/tools/schema_generator/README.md is written in an unsupported language. File is not indexed.
0001 # Schema Generator 0002 0003 This Python utility parses Google API Discovery documents which describe 0004 particular APIs, and generates C++ parsers and serializers for the 0005 schemas defined there. 0006 0007 The tool has been written initially to generate C++ code for schemas for the 0008 People API (which contains over 40 schemas that would otherwise have to be 0009 written out by hand, including serializers and parsers), so it may contain 0010 logic that is specific to this API. It's perfectly fine to tweak this tool 0011 to support other APIs. 0012 0013 This tool is not currently intended to generate C++ code at build-time, 0014 instead, its intended to generate classes, properties, getters and setters 0015 for all the schemas (which is otherwise tedious and error-prone work), but 0016 there's no guarantee that the generated code will compile - usually it will 0017 need some manual editing afterwards that would otherwise be too complex or 0018 unfeasible to implement into this tool in some generic way (or I'm just too 0019 lazy to do that). 0020 0021 However, the long-term plan for this tool is to generate C++ code for all 0022 the supported APIs at compile time based on the Discovery documents, but 0023 that's a distant future... 0024 0025 ## API definition file 0026 0027 The API definition file is a custom YAML file that describes the API 0028 discovery document and some additional configuration for the tool. 0029 The file looks like this: 0030 0031 ```yaml 0032 # Name of the API 0033 name: PeopleV1 0034 0035 # C++ namespace (will be automatically prefixed with KGAPI2::) 0036 namespace: People 0037 0038 # Name of the C++ export macro 0039 export_macro: KGAPIPEOPLE_EXPORT 0040 0041 # URL of the API's discovery document 0042 discovery_uri: https://people.googleapis.com/$discovery/rest?version=v1 0043 0044 # URL of the API's reference documentation 0045 reference_base_uri: https://developers.google.com/people/api/rest/v1/people 0046 0047 # The version of LibKGAPI where the API first appeared, used in @since doxygen tags. 0048 since: "5.19.0" 0049 0050 # List of classes that should inherit KGAPI2::Object 0051 kgapiobjects: 0052 - Person 0053 0054 # List of schema names that should be ignored. The name can contain an 0055 # wildcard symbol (*) at the beginning or end to exclude all schemas ending 0056 # or starting with the specified name. 0057 excludeObjects: 0058 - "*Request" 0059 - "*Response" 0060 - "ContactToCreate" 0061 - "SearchResult" 0062 - "Status" 0063 - "Empty" 0064 - "Date" 0065 0066 # List of OldName: NewName pairs. The generator will rename any object or reference 0067 # with the old name to the new name. Can be used to avoid conflicts with C++/Qt/system 0068 # names. 0069 renameObjects: 0070 Locale: PersonLocale 0071 ```