Limit generation of schema headers in JSON-format serialization by length

...rather than the actual number of headers.

We're limited (by Jetty and nginx) to 6k *total* headers, so I'm limiting
the schema headers to 5k (since that leaves 1k left over for everything
else).