Google JSON style guide package

xuanbao · · 955 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I was planning on writing a package that would automate creating json according to the Google JSON Style guide.</p> <p><a href="https://google-styleguide.googlecode.com/svn/trunk/jsoncstyleguide.xml" rel="nofollow">https://google-styleguide.googlecode.com/svn/trunk/jsoncstyleguide.xml</a></p> <p>I did not want to recreate the wheel, so I wanted to check if anyone knew of a package out there already.</p> <p>Also I wanted to know if there were any feature requests. Some things I was going to add were:</p> <p>An error code registry</p> <p>Setting Defaults for service</p> <p>Automatic writing Marshaling and writing to ResponseWriter and Unmarshaling from Response. </p> <p>Thoughts? I would also be willing to collaborate, if someone wanted to work on this as well?</p> <hr/>**评论:**<br/><br/>binaryblade: <pre><p>umm, enocding/json is in the stdlib.</p></pre>jasonrichardsmith: <pre><p>The structure of this API response style is not.</p> <p>Now you could recreate this structure and reuse it personally, or I/we could develop a community package.</p></pre>: <pre><p>[deleted]</p></pre>jasonrichardsmith: <pre><p>I think you are misreading the intention. The intention is not to provide correctly structured json, the intention is to provide json responses in accordance with the style guide. Meaning having values stored in a standardized fashion in accordance withe the style guide.</p></pre>BoTuLoX: <pre><p>I&#39;m going to guess your intent is readability. Why not simply use YAML?</p></pre>michaelbironneau: <pre><p>Interesting idea, but just glancing over the style guide you&#39;ll need users of your library to provide lots of additional information (eg. <code>error.domain</code>) instead of just passing you an <code>error</code>, for example. By the time a developer is done understanding what all this information means, they&#39;ve already read the style guide and they might as well use encoding/json to do the same thing without introducing another dependency into their work.</p> <p>One way you could make this useful to a general audience is if it could plug into an existing ORM-to-REST builder such as go-json-rest, because then you might have some of this information already, but I&#39;m not sure how feasible that is.</p></pre>jasonrichardsmith: <pre><p>I wasn&#39;t building a robust tool, I am just building an easy structure anyone can import or fork. Got most of it written already.</p> <p><a href="https://github.com/jasonrichardsmith/google_json_style" rel="nofollow">https://github.com/jasonrichardsmith/google_json_style</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

955 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传