Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Issue 16462004: Add optional schema compiler error messages

Created:
7 years, 6 months ago by Aaron Jacobs
Modified:
7 years, 2 months ago
CC:
chromium-reviews, evan.peterson.ep_gmail.com, jshumway
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Add optional schema compiler error messages Provides the ability to generate error messages within schema-compiled code for ease of debugging. Error messages may be enabled by adding a 'generate_error_messages' property to json schema, e.g. "generate_error_messages": true New sample: https://gist.github.com/Samusaaron3/32e36eb059a6911f3652 Old sample: https://gist.github.com/Samusaaron3/476bbc7114b90cfb0a0d BUG=234834

Patch Set 1 #

Total comments: 10

Patch Set 2 : Clark's requests #

Total comments: 41

Patch Set 3 : Kalman's requests #

Total comments: 24

Patch Set 4 : Kalman's requests #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+188 lines, -62 lines) Patch
M tools/json_schema_compiler/cc_generator.py View 1 2 3 14 chunks +133 lines, -50 lines 2 comments Download
M tools/json_schema_compiler/code.py View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M tools/json_schema_compiler/h_generator.py View 1 2 3 5 chunks +17 lines, -7 lines 1 comment Download
M tools/json_schema_compiler/model.py View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M tools/json_schema_compiler/util.h View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M tools/json_schema_compiler/util.cc View 1 2 3 1 chunk +25 lines, -0 lines 3 comments Download
M tools/json_schema_compiler/util_cc_helper.py View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Aaron Jacobs
7 years, 6 months ago (2013-06-06 03:57:39 UTC) #1
cduvall
could you post a gist of a sample of what the generated code looks like? ...
7 years, 6 months ago (2013-06-07 19:10:42 UTC) #2
Aaron Jacobs
Gist link added to description https://codereview.chromium.org/16462004/diff/1/tools/json_schema_compiler/cc_generator.py File tools/json_schema_compiler/cc_generator.py (right): https://codereview.chromium.org/16462004/diff/1/tools/json_schema_compiler/cc_generator.py#newcode188 tools/json_schema_compiler/cc_generator.py:188: 'std::string* error) {') On ...
7 years, 6 months ago (2013-06-07 20:36:12 UTC) #3
Aaron Jacobs
kalman: Schema compiler error messages you requested, let me know what you think.
7 years, 6 months ago (2013-06-07 21:05:07 UTC) #4
not at google - send to devlin
awesome. The comments are all around a couple of themes really, and yeah, keep in ...
7 years, 6 months ago (2013-06-11 18:33:43 UTC) #5
Aaron Jacobs
As a heads up, tomorrow is going to be my last day of work for ...
7 years, 6 months ago (2013-06-14 02:00:37 UTC) #6
not at google - send to devlin
https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py File tools/json_schema_compiler/h_generator.py (right): https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py#newcode31 tools/json_schema_compiler/h_generator.py:31: self._error_parameter = ', std::string* error = NULL' On 2013/06/14 ...
7 years, 6 months ago (2013-06-14 02:14:01 UTC) #7
Aaron Jacobs
https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py File tools/json_schema_compiler/h_generator.py (right): https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py#newcode31 tools/json_schema_compiler/h_generator.py:31: self._error_parameter = ', std::string* error = NULL' On 2013/06/14 ...
7 years, 6 months ago (2013-06-14 21:11:30 UTC) #8
not at google - send to devlin
https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py File tools/json_schema_compiler/h_generator.py (right): https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py#newcode31 tools/json_schema_compiler/h_generator.py:31: self._error_parameter = ', std::string* error = NULL' On 2013/06/14 ...
7 years, 6 months ago (2013-06-14 21:14:15 UTC) #9
Aaron Jacobs
https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py File tools/json_schema_compiler/h_generator.py (right): https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py#newcode31 tools/json_schema_compiler/h_generator.py:31: self._error_parameter = ', std::string* error = NULL' On 2013/06/14 ...
7 years, 6 months ago (2013-06-14 21:21:24 UTC) #10
not at google - send to devlin
cool. yeah, most of those comments should be applied across the code, not just to ...
7 years, 6 months ago (2013-06-14 21:48:39 UTC) #11
Jeffrey Yasskin
https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py File tools/json_schema_compiler/h_generator.py (right): https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py#newcode31 tools/json_schema_compiler/h_generator.py:31: self._error_parameter = ', std::string* error = NULL' On 2013/06/14 ...
7 years, 6 months ago (2013-06-14 21:58:47 UTC) #12
not at google - send to devlin
On 2013/06/14 21:58:47, Jeffrey Yasskin wrote: > https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py > File tools/json_schema_compiler/h_generator.py (right): > > https://codereview.chromium.org/16462004/diff/7001/tools/json_schema_compiler/h_generator.py#newcode31 ...
7 years, 6 months ago (2013-06-14 21:59:53 UTC) #13
Aaron Jacobs
https://codereview.chromium.org/16462004/diff/14001/tools/json_schema_compiler/cc_generator.py File tools/json_schema_compiler/cc_generator.py (right): https://codereview.chromium.org/16462004/diff/14001/tools/json_schema_compiler/cc_generator.py#newcode206 tools/json_schema_compiler/cc_generator.py:206: 'json_schema_compiler::util::ValueTypeToString(value.GetType())')) On 2013/06/14 21:48:39, kalman wrote: > can you ...
7 years, 6 months ago (2013-06-15 00:47:17 UTC) #14
Aaron Jacobs
On 2013/06/15 00:47:17, Aaron Jacobs wrote: > https://codereview.chromium.org/16462004/diff/14001/tools/json_schema_compiler/cc_generator.py > File tools/json_schema_compiler/cc_generator.py (right): > > https://codereview.chromium.org/16462004/diff/14001/tools/json_schema_compiler/cc_generator.py#newcode206 ...
7 years, 6 months ago (2013-06-15 01:30:22 UTC) #15
not at google - send to devlin
7 years, 6 months ago (2013-06-19 17:02:07 UTC) #16
thanks. lg but needs tests!

Jared/Evan is one of you able to triage this patch to somebody on your end? It
doesn't have to be done right away but I don't want it to disappear.

Basically there are those few last comments + it needs tests :\ not particularly
glamorous, sorry. Tests are important. I have no idea if this stuff even
compiles, though presumably Aaron does.

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
File tools/json_schema_compiler/cc_generator.py (right):

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
tools/json_schema_compiler/cc_generator.py:669: '"unable to populate array
\'%%(array_key)s\'"'))
better this explicitly be parent_key

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
tools/json_schema_compiler/cc_generator.py:919: return ', '.join(str(p) for p in
params)
here and below should be something more like:

if self._generate_error_messages:
  params = list(params) + ['std::string* error']
...

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
File tools/json_schema_compiler/h_generator.py (right):

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
tools/json_schema_compiler/h_generator.py:403: return ', '.join(str(p) for p in
params)
see list thing again

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
File tools/json_schema_compiler/util.cc (right):

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
tools/json_schema_compiler/util.cc:80: return "int";
"integer"

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
tools/json_schema_compiler/util.cc:82: return "double";
"number"

https://codereview.chromium.org/16462004/diff/30001/tools/json_schema_compile...
tools/json_schema_compiler/util.cc:92: ;
no default case

Powered by Google App Engine
This is Rietveld 408576698