Jump to content

Extension talk:JsonConfig/Flow

About this board

json-ld in mediawiki pages

2
Cojoilustrado (talkcontribs)

Hi. I'm trying to add json-ld schema to my wiki's templates for microdata, but mediawiki renders the code as text and shows up in the page. Any way this extension can handle that?


For example, this

<script type="application/ld+json">

{

  "@context": "https://schema.org",

  "@type": "MusicAlbum",

  "byArtist": {

    "@type": "MusicGroup",

    "name": "Radiohead"

  },

  "genre": "Alt/Punk",

  "image": "king-of-limbs.jpg",

  "name": "King of Limbs",

  "numTracks": "8"

    }

</script>

Thiemo Kreuz (WMDE) (talkcontribs)

I'm sorry, but the question appears to be entirely unrelated to this extension. Script tags are not allowed for obvious security reasons.

Reply to "json-ld in mediawiki pages"

Enabling mw.ext.data should be mentioned

1
Summary by Tmv

this was mentioned here

BjsMimot (talkcontribs)

How to get values for Wikibase datatype 'Tabular data' from local wiki rather than from commons.wikimedia.org?

1
MW Kappa (talkcontribs)

We are wondering whether it is possible to configure JsonConfig for using the local wiki as a source of the values for Wikibase properties with type 'tabular data'. Our current configuration is

$wgJsonConfigModels['JsonConfig.TabularContent.local'] = 'JsonConfig\JCTabularContent';
$wgJsonConfigs['JsonConfig.TabularContent.local'] = array(
        'namespace' => 486,     
        'nsName' => 'Data', 
        // pattern for page name
        'pattern' => '/^[A-Z]*[a-z]*\.tab$/',
        'isLocal' => true,
);

but this does not work as desired. Wikibase still searches for *.tab pages in commons.mediawiki.org rather than in the local wiki.

Reply to "How to get values for Wikibase datatype 'Tabular data' from local wiki rather than from commons.wikimedia.org?"

How to query jsontables from local wikidata instance using API

1
Keystester (talkcontribs)

The configuration for my jsonconfig extension in the LocalSettings.php is the following.

$wgJsonConfigEnableLuaSupport = true;
$wgJsonConfigModels['Tabular.JsonConfig'] = 'JsonConfig\JCTabularContent';
$wgJsonConfigs['Tabular.JsonConfig'] = [ 
'namespace' => 486, 
'nsName' => 'Data',
// page name must end in ".tab", and contain at least one symbol
'pattern' => '/.\.tab$/',
'license' => 'CC0-1.0',
'isLocal' => true,
'store' => true,
];

When i try to query for json tables that i have stored on the instance using the following,

<DOMAIN HERE>/w/api.php?action=query&list=search&srsearch=tab contentmodel:Tabular.JsonConfig &srnamespace=486&srlimit=10&format=json


i get the following result

{"batchcomplete":"","query":{"searchinfo":{"totalhits":0},"search":[]}}


What correction must i make to my api query statement to make this work ?

Reply to "How to query jsontables from local wikidata instance using API"

Wiki is not accessible with JsonConfig

1
139.47.42.2 (talkcontribs)

Hello,

I uploaded the JsonConfig in the extension and then added the code wfLoadExtension ( 'JsonConfig' ); in the LocalSettings. This resulted in an error message with my wiki. I have wiki version 1.29, so I tried again with require_once " $IP /extensions/JsonConfig/JsonConfig.php" ;. But that did not help.

What could be the reason for this?

Kind regards

Reply to "Wiki is not accessible with JsonConfig"

How to make page_content_model column in MySQL page table to automatically be set to 'json' instead of 'wikitext' for *.json pages in Data namespace?

1
Jasonkhanlar (talkcontribs)

How can I configure this extension to use the JsonContentHandler class for `'pattern' => '/.\.json$/'` page titles? In MySQL database, I want to be able to create pages that end in ".json" for the `page_content_model` column to be "json" value by default, instead of "wikitext" content model type. Is this possible with JsonConfig extension?

Here is my LocalSettings.php configuration attempt so far:

   $wgJsonConfigModels['Json.JsonConfig'] = 'JsonContentHandler';
   //$wgJsonConfigModels['Json.JsonConfig'] = [];
   //$wgJsonConfigModels['Json.JsonConfig']['class'] = 'JsonConfig\JCDataContent';
   //$wgJsonConfigModels['Json.JsonConfig']['view'] = 'JsonConfig\JCDefaultContentView';
   //$wgJsonConfigModels['Json.JsonConfig'] = 'JsonConfig\JCDataContent';
   $wgJsonConfigs['JSON.JsonConfig'] = [
       'cacheExp' => 86400,
       'cacheKey' => ,
       'flaggedRevs' => false,
       'isLocal' => true,
       'license' => 'CC0-1.0',
       'model' => 'Json.JsonConfig',
       'namespace' => 486,
       'nsName' => 'Data',
       'nsTalk' => 'Data_talk',
       'pattern' => '/.\.json$/',
       //'pattern' => '/^Json:./',
       'store' => true
    ];

Edited to add: Almost, and I guess it's good enough, but if I change 1 line above to:

   $wgJsonConfigModels['Json.JsonConfig'] = null;

then it seems to work. The MySQL database page table page_content_model column value shows as "Json.JsonConfig" instead of "json" which is probably because of the configuration (which works, and is good enough for now), but otherwise I am still curious if there is any way to configure this so that the value will be "json" to use the existing content model type that appears to be the exact same (but I didn't verify this)

Also see https://phabricator.wikimedia.org/T305571 which is what I read through to come to this solution.


Also, when I try to edit a *.json page (that I manually changed the content model type at wiki/Special:ChangeContentModel to 'json') with the models configuration above (= null for "Json.JsonConfig" key), when I try to visit a page with the 'json' content model type, instead of the 'Json.JsonConfig' model type, when I try to edit the page I see:

Content format not supported

The content format application/json+pretty is not supported by the content model JSON.

From a standpoint of the data types being practically exactly the same, and humanly capable of support capabilities, this type of error message seems inconvenient, and probably more of a database technical constraint than an actual inability to produce similar visual user interface capabilities that function practically identically, I would suspect.

   $handler->isSupportedFormat( $this->contentFormat )

Perhaps is there a way that this can evaluate as true in includes/EditPage.php in such a condition?

Also see https://phabricator.wikimedia.org/T307978

Reply to "How to make page_content_model column in MySQL page table to automatically be set to 'json' instead of 'wikitext' for *.json pages in Data namespace?"

How to enable in 3rd party wikis?

6
Summary by Krabina

please igore this, my mistake

Krabina (talkcontribs)
Redheadkelly (talkcontribs)

Krabina curious if you ever got this working?

Krabina (talkcontribs)

unfortunately not

Redheadkelly (talkcontribs)

That is unfortunate. I was so excited to add the maps to my wiki. It's been very frustrating.

Krabina (talkcontribs)

Well for maps there is the Extension:Maps that works without JsonConfig and can handle GeoJson.

Redheadkelly (talkcontribs)

That's my next approach. Thanks.

Reply to "How to enable in 3rd party wikis?"

What does this error message mean?

2
Farvardyn (talkcontribs)

What does this error message mean?

[10-Mar-2021 23:31:58 America/Chicago] PHP Warning:  API call had warnings trying to get remote JsonConfig: warnings={"main":{"*":"Subscribe to the mediawiki-api-announce mailing list at \u003Chttps://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce\u003E for notice of API deprecations and breaking changes. Use Special:ApiFeatureUsage to see usage of deprecated features by your application."},"revisions":{"*":"Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."}}, query={"action":"query","titles":"Data:I18n/Shared Template Warning.tab","prop":"revisions","rvprop":"content","continue":""} [Called from JsonConfig\JCUtils::warn in /extensions/JsonConfig/includes/JCUtils.php at line 54] in /includes/debug/MWDebug.php on line 333

Farvardyn (talk) 08:36, 12 March 2021 (UTC)

Farvardyn (talkcontribs)

bump?

Reply to "What does this error message mean?"

Setting up commons as the data repo for an external wiki

5
Bawolff (talkcontribs)

It would be really cool if the examples could document how to setup commons as the data storage wiki, when using this as a third party.

There's been lots of questions related to that lately as more and more lua modules store their i18n on commons, and people try and copy those lua modules.

Kjvowen (talkcontribs)

The configuration settings for accessing ".tab" files on commons is here: Extension:JsonConfig/Tabular#Configuration

The same thing works for Map data:

$wgJsonConfigModels['Map.JsonConfig'] = 'JsonConfig\JCMapDataContent';
$wgJsonConfigs['Map.JsonConfig'] = [
'namespace' => 486,
'nsName' => 'Data',
// page name must end in ".map", and contain at least one symbol 'pattern' => '/.\.map$/',
'isLocal' => false,
];

$wgJsonConfigs['Map.JsonConfig']['remote'] = ['url' => 'https://commons.wikimedia.org/w/api.php'];
Alexis Jazz (talkcontribs)
Bawolff (talkcontribs)

honestly, i think its kind of weird that commons became the central repo for template translations, and i have some reservations sbout the design of the tabular data system in general, but well, here we are, guess its too late now

Sophivorus (talkcontribs)

I tried the above config and many variations and the errors persist. If I interpret correctly then, it's currently not possible for a third-party wiki to reuse the Data namespace at Commons?

Reply to "Setting up commons as the data repo for an external wiki"

Extension:Kartographer

1
Hollosch (talkcontribs)
Reply to "Extension:Kartographer"