--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
rather than setting it to an appropriate bag and the right thingYes, I just tried simply removing the contents of the bag field
happened. So I would guess killing that field on drag would be the
right way to go.
The results that are happening is because of two things:If a tiddler has the type "application/json" does TiddlyWeb serve the text
field directly as the JSON representation, rather than serialising the
tiddler as normal? That's a bit unexpected if so. Is there a way I can
retrieve the ordinary serialized JSON representation?
The tiddler is being PUT with content-type: application/json
AND
The JSON object has a type field set to 'application/json'.
The upshot of this is that the tiddler is being accepted as a
pseudo-binary tiddler. When you GET the tiddler with either a
default Accept header OR with an Accept header that matches its
type you will get it in its raw form (the contents of the text
field) with a sent content-type field of the stored 'type' field.
This has a side effect of making text/plain, text/html and
application/json have "special" meaning when accessing a tiddler.
To get the tiddler back as a tiddler in JSON form it needs to put
with a 'type' field that is not application/json.
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
>
> Ah, yes, sounds like the plugin is coming in with a "bag" field, and TW5 is
> blindly accepting it. I guess we should remove the "bag" field on import so
> that the same processing would occur as with a manually newly created
> tiddler?
Yes, I just tried simply removing the contents of the bag field
rather than setting it to an appropriate bag and the right thing
happened. So I would guess killing that field on drag would be the
right way to go.
Is it too late for a single tiddler that contains tiddlers to have a
type of its own like application/tiddlywiki+json? If you then PUT as
application/json with a type of application/tiddlywiki+json you
should be able to get the right thing back.
Text tiddlers clearly contain plain text but we call them
text/x-tiddlywiki and text/vnd.tiddlywiki frequently?
Apparently this case hasn't come up in the past. The standard way to
store structured data has been to use the existing attributes and
fields _on_ a tiddler, not put structured data _in_ the text field
of the tiddler.
Obviously the aggregate tiddlers-in-a-single-tiddler case doesn't
map well to that. From the server's standpoint this would make the
most sense: what we have here are tiddlers and thats it, none of
these "weird" things that are actually containers of tiddlers. This
buys some granularity of reuse too, in case that's of interest.
Would it be possible to explode the single tiddler to its constituent
tiddlers before PUTting to the server and recompose them on GET
(perhaps by way of transclusion)?
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
Strictly speaking in neither case are they getting text/html nor
application/json, they are getting tiddlers which _contain_ text/html
and application/json. I think this is important.
Actually, that's the rule that is being followed:
If you PUT something in a JSON container that you are claiming
is JSON if you ask for JSON back, that's what you get. Same
thing happens if you PUT something in a JSON container that you
are claiming is image/png when you ask for image/png back you
will get an image.
This rule works fine for everything _but_ application/json which is
why I've suggested this change:
If that change is made _and_ TW5 starts PUTting and GETting tiddlers* TiddlyWeb extends itself to treat "application/x-tiddler+json" in
much the same way it treats "application/json" now, deprecating
but continuing to support the latter.
as application/x-tiddler+json, then you will get the results that
you want whatever value you put in the type field of the tiddler.
That change makes the claim of "we've got a thing called a tiddler
_in_ some JSON" and makes no claim on what the tiddler itself is
claiming as its type.
I'm happy to make that change (but it would need to be a few days
from now, not immediately).
However, the same logic that drives that change seems like it might
be sensible for TW5 too, thus why I've brought it up. Up to you
though, I suppose.
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
Yes, if/when that change is made the content type for PUTting a JSON
container of _any_ type of tiddler will be as above, and you can set
the 'type' to whatever you want.
There are, of course, other content types with which you can PUT a
tiddler but JSON is the primary one.
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
I've had some scenic train time to think about this today, or perhaps it
was the wind tunnel clearing my pathways
- either way, I've come to the
conclusion that a tiddler's `type` refers exclusively to that tiddler's
`text`.
Thus PUTing a tiddler with `type: text/x-tiddler` is not only
redundant, it also eliminates the standard mechanism for describing the
content type of the tiddler body. IOW, it's a hack.
In short: If the body is $contentType, then `type` should say so.
Where `text/x-tiddler` (or whatever) makes perfect sense is on GET, as
that's where the client states what it expects to receive - and clearly
in the case of tiddler editors, that's a tiddler rather than "some
JSON".
(Note that `text/x-tiddler` on PUT would make sense if the HTTP
Content-Type header didn't end up as the respective tiddler's `type`
attribute - but that's a different, probably unhelpful discussion.)
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
This is one issue. I'm not sure it is wrong but it might beTW5 allows tiddlers to have the type "application/json", and I still don't
see why that is wrong.
incomplete. A tiddler which contains JSON should say so in some
fashion, but there are different types of tiddlers which contain JSON.
Some of them are aggregates of tiddlers, a form that TW5 has awareness
of what to do with. Some of them are raw JSON of a form that TW5 doesn't
know what to do with. It (seems to me that it) would be better if that
decision making was controlled by the type field rather inspection of
the contents of the text field, or some other field (if, in fact, that
is what is going on).
This is the other issue. I've conceded that the content-type forTW5 uses "application/json" as the content type for PUTting modifications
to the server; at one point I thought that this discussion was suggesting
that the content-type for PUTting should be something else.
PUTting and GETting should be something different.
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscribe@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.
{"key": "value"}
Everything is perfectly fine if I click: https://dev.tweb.at/api/bags/default_public/tiddlers/data-json
It returns: {"key": "value"} -> OK as expected for the browser.
There has to be a possibility to get exactly that behaviour, because it my be needed that way.
But if I open https://dev.tweb.at/ and open the "data-json" tiddler
TiddlyWiki GET request header is Accept:"application/json"
The server sends {"key": "value"} ... Which TiddlyWiki can't handle. ->> ERROR
IMO if TiddlyWiki requests "Accept: application/json" the TiddlyWeb behaviour is right.
The missing thing now is a possibility to retrieve the tiddler json representation. So that TW can handle it.
------------
a test only: https://dev.tweb.at/api/bags/default_public/tiddlers/data-json.txt is fine.
------------
I think the cleanest way is, TW changes the request to
GET the tiddler json representation to: Accept: text/vnd.tiddlywiki+json
If you have a look at: http://www.iana.org/assignments/media-types/media-types.xhtml
There are several vnd.xxx+json definitions. So it should be ok.
---------
IMO TiddlyWeb needs to change the mechanism too, because if I PUT application/json
I expect this link: https://dev.tweb.at/api/bags/default_public/tiddlers/data-json to deliver application/json ...
but there still needs to be a way to get the tiddler json representation.
So imo : https://dev.tweb.at/api/bags/default_public/tiddlers/data-json.json should return it.
Since ".json" is a convention that returns a tiddler it should be true for every tiddler.
just my thoughts
have fun!
mario
I've created the pair on the tiddlyweb side:
https://github.com/tiddlyweb/tiddlyweb/issues/99
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.