smart-classic / smart_sample_apps

SMART Sample Apps
Apache License 2.0
32 stars 31 forks source link

API Playground improvements #25

Closed nschwertner closed 12 years ago

nschwertner commented 12 years ago
nschwertner commented 12 years ago

The one issue here is that the code highlighter (http://code.google.com/p/google-code-prettify/) is a bit inefficient for large chunks of code and hoses the browser. For now, I added an arbitrary limit on the size of the RDF-XML that triggers prettification (i.e. no prettification will be performed on "large" payloads): https://github.com/chb/smart_sample_apps/blob/playground-improvements/static/framework/api_playground/controllers/main_controller.js#L146

The prettification on the NTripples and JSON-LD outputs is not very good. I look at a couple code prettifiers, but the results are similar (without writing custom plugins for them). So, perhaps we could limit the prettification to the RDF-XML and increase the limit on the maximum RDF-XML chunk size that can be prettified?

jmandel commented 12 years ago

Looking good! A few issues I spotted:

> response.graph.where("?s ?p ?o.");
> response.objects.of_type.Medication
nschwertner commented 12 years ago

Super. I will address the #1 and #3 issues. For #2, could you make sure that you are using the updated version of the JS client (I made a few changes to it to support objectification in the API Playground)?

jmandel commented 12 years ago

I added a commit to deal with #2: the problem was with circular references between medications and fulfillments (each points to the other, which works great in memory but fails on JSON.stringify (because it doesn't support circular references).