summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/util.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add support for passing errors through PopulateArrayFromList.reillyg2015-05-061-0/+90
| | | | | | | | | | | | | | | | When a JSON schema includes an array of objects PopulateArrayFromList calls a specialized PopulateItem instance for the generated object type. When compiled with generate_error_messages=True the generated type's Populate method expects to receive an error parameter. This patch adds versions of the PopulateArrayFromList and PopulateItem functions that pass through and provide that parameter. This capability is required for a new manifest key that will include an array of objects being added as part of issue 468955. Review URL: https://codereview.chromium.org/1128523003 Cr-Commit-Position: refs/heads/master@{#328471}
* json_schema_compiler: Use std::vector<char> for binary values.pneubeck2015-01-201-3/+17
| | | | | | | | | | | | | | | | | | | | This change enables ArrayBuffer[] in IDLs / json-schema descriptions of extension APIs. This affects the code generated from these descriptions: The C++ members (and arguments to the ::Create functions) that refer to binary values are now represented by std::vector<char> instead of std::string. All usages are adapted in this CL. While there, this change updates the affected code parts - to use vector_as_array where it makes sense - unnecessary copies are removed where easily possible - and range based assigns ( ::assign(InputIterator first, InputIterator last) or the same with c'tors) are uniformly used. BUG=448383 TBR=stevenjb@chromium.org (chromeos/dbus was reviewed by bartfab@) Review URL: https://codereview.chromium.org/820673004 Cr-Commit-Position: refs/heads/master@{#312183}
* Cleanup: Some simplifications in json_schema_compiler.pneubeck2015-01-191-21/+15
| | | | | | | | | | | There were several GetItemFromList functions that extract an element from a ListValue and converted it. This change consolidates the list access into a single place and simplifies the GetItemFromList to the conversion only (renamed to PopulateItem). No functional change. Review URL: https://codereview.chromium.org/851673003 Cr-Commit-Position: refs/heads/master@{#312082}
* Remove the Value class names from the global namespace.avi@chromium.org2013-12-241-9/+9
| | | | | | | | | | BUG=88666 TEST=no change TBR=ben@chromium.org Review URL: https://codereview.chromium.org/116543010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242440 0039d316-1c4b-4281-b951-d872f2087c98
* c/b/extensions: Do not use Value::Create*.DHNishi@gmail.com2013-08-141-4/+4
| | | | | | | | | | src/tools/json_schema_compiler: Do not use Value::Create*. BUG=160586 Review URL: https://chromiumcodereview.appspot.com/22885002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217444 0039d316-1c4b-4281-b951-d872f2087c98
* Add optional schema compiler error messages and unit tests.DHNishi@gmail.com2013-08-121-0/+23
| | | | | | | | | | | | | Provides the ability to generate error messages within schema-compiled code for ease of debugging. Error messages may be disabled by adding a 'generate_error_messages' property to json schema, e.g. "generate_error_messages": false Error generation mostly written by Aaron Jacobs (https://codereview.chromium.org/16462004/). BUG=234834 Review URL: https://chromiumcodereview.appspot.com/22228002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217118 0039d316-1c4b-4281-b951-d872f2087c98
* Add base namespace to more values in sync and elsewhere.brettw@chromium.org2013-06-211-8/+8
| | | | | | | | | | This makes sync and net compile with no "using *Value". BUG= Review URL: https://codereview.chromium.org/17034006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207907 0039d316-1c4b-4281-b951-d872f2087c98
* Overhaul JSON Schema Compiler to support a number of features required tokalman@chromium.org2013-01-171-13/+16
| | | | | | | | | | | | | | | | | | | | support the full range of JSON/IDL features, improve the interface of generated code, and improve generated code formatting, notably: * Make "choices" generate a struct containing each possible type, rather than multiple fields with different names plus and enum. This makes it possible to embed choices inside containers - notably within arrays (as in bug). It also improves optional choices detection. * Remove the Any C++ type generated by "any", and model it as a base::Value. * Make "additionalProperties" generated a std::map with the actual types as values, rather than just a DictionaryValue forcing callers to extract types. * Fix enum naming, it was unnecessarily including the namespace as a prefix. R=yoz@chromium.org BUG=162044 Review URL: https://codereview.chromium.org/11827026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177361 0039d316-1c4b-4281-b951-d872f2087c98
* Correct const accessors in base/values.(h|cc), Part II (ListValue)vabr@chromium.org2012-08-031-2/+2
| | | | | | | | | | | | | | For problem description and other info please see the BUG page. This is for ListValue. BUG=138946 TEST=N/A (no fix & no new feature) TBR=jar,zelidrag,scottbyer,mpcomplete,darin,achuith,sky,estade,atwilson,grt,thakis,jamesr,hans,sadrul,pastarmovj Review URL: https://chromiumcodereview.appspot.com/10837044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149819 0039d316-1c4b-4281-b951-d872f2087c98
* json_schema_compiler: any, additionalProperties, functions on typescalamity@chromium.org2012-03-021-2/+17
| | | | | | | | | | | | Add support and tests for more json types. Also fixed a number of API jsons. BUG= TEST= Review URL: http://codereview.chromium.org/9491002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124643 0039d316-1c4b-4281-b951-d872f2087c98
* json_schema_compiler: make util::AddItemToList take a const reference to ↵calamity@chromium.org2012-02-201-1/+1
| | | | | | | | | | | match the compiler. BUG= TEST= Review URL: http://codereview.chromium.org/9423035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122725 0039d316-1c4b-4281-b951-d872f2087c98
* Adds support for the "choices" and "any" types to json_schema_compiler, as wellcalamity@chromium.org2012-02-151-57/+31
| | | | | | | | | | | | | | | as miscellaneous improvements to get at least 3 more schema files compiling: windows, tabs, and the in-progress experimental.declarative. For description of the generator, see http://codereview.chromium.org/9114036/ BUG= TEST= Review URL: http://codereview.chromium.org/9309044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122082 0039d316-1c4b-4281-b951-d872f2087c98
* Code generation for extensions apicalamity@chromium.org2012-01-271-0/+82
This is a preliminary code review for a code generator. The tool's purpose is to generate the tedious serialization code that needs to be written when defining a new extensions api. It generates from the json files in chrome/common/extensions/api. As an example usage, chrome/browser/extensions/extension_permissions_api.cc has been changed to use a class generated from permissions.json. The tool has been integrated into the build system and generates compiling and working code (for permissions.json at least) BUG= TEST= Review URL: http://codereview.chromium.org/9114036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119405 0039d316-1c4b-4281-b951-d872f2087c98