User "Brion VIBBER" posted a comment on MediaWiki.r86302.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/86302#c16513
Commit summary:

* (bug 28586) YAML: strings that are the same as boolean literals
* (bug 28591) Update/replace/supplement spyc (YAML parsing library)
* YAML API output is now 1.2 compliant, using JSON as the formatter

YAML 1.2 spec is a JSON subset - "The primary objective of this revision is to 
bring YAML into compliance with JSON as an official subset. YAML 1.2 is 
compatible with 1.1 for most practical applications - this is a minor 
revision." [1] Per discussion with Tim, switch YAML to use the JSON formatter

Was originally going to delete the ApiFormatYaml per Tim, but class needed to 
keep nicer (and apparent) output in API help page

Hence made subclass ApiFormatJson, minimal method overriding

spyc.php deleted from libs

[1] http://www.yaml.org/spec/1.2/spec.html#id2803629

Comment:

Just a note -- there are differences in the output between the previous YAML 
outputter and the JSON outputter, but I think it's actually a bug in the old 
YAML generator. :)

[http://en.wikipedia.org/w/api.php?action=query&prop=revisions&meta=siteinfo&titles=Main%20Page&rvprop=user|comment&format=yamlfm
 yaml]
<pre>
query:
  pages:
    -
      pageid: 15580374
      ns: 0
</pre>


[http://en.wikipedia.org/w/api.php?action=query&prop=revisions&meta=siteinfo&titles=Main%20Page&rvprop=user|comment&format=jsonfm
 json]
<pre>
        "query": {
                "pages": {
                        "15580374": {
                                "pageid": 15580374,
                                "ns": 0,
</pre>

The YAML outputter incorrectly turned query.pages from a map into a vector 
array, probably because it saw integer keys but didn't actually vet them. (Ah 
PHP, your frankenstein hashmap+array construct strikes again!) It's possible 
that YAML-using clients that assumed the broken structure may not always work 
with the new, HOWEVER the new output will actually be the correct output 
structure. So that's probably good.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to