Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add JSON schema to compression listed mimetypes #39

Closed
fruitl00p opened this issue Aug 27, 2014 · 7 comments
Closed

add JSON schema to compression listed mimetypes #39

fruitl00p opened this issue Aug 27, 2014 · 7 comments

Comments

@fruitl00p
Copy link

I know this seems trivial, but i believe this is going to grow in popularity and the mimetype is currently missing: JSON schema: application/schema+json

@alrra
Copy link
Member

alrra commented Aug 27, 2014

@fruitl00p Thanks for opening this issue!

Some questions:

  • Do these types of files use a specific file extension, or they are just basically .json? (by quickly scanning the link you provided, I couldn't find any information on that).
  • Are there any downsides to just sending this types of files with the JSON media type (namely: application/json)?

Cc: @kriszyp

application/schema+json

application/schema+json is just proposed, not yet "official" (not that it matters, just an observation).

@fruitl00p
Copy link
Author

@alrra Thanks for the prompt reply. The files are commonly passed via a plain .json-extension. The downside to just passing it along as application/json depends on the libraries parsing them ;)

I hestistated posting the issue cause it might also open a can of worms for other gzip-able types... ? (i just suspect there might be alot still missing?)

@alrra
Copy link
Member

alrra commented Aug 27, 2014

The downside to just passing it along as application/json depends on the libraries parsing them ;)

@fruitl00p Do you know any libraries that have problems because the resource was sent with an incorrect media type (just curious)?

The files are commonly passed via a plain .json-extension

Then, I don't think we can set the media type as we can't know exactly which files will contain a JSON schema (but users can do that on their own). However, things such as caching, compression etc., are quite easy to configure based on the media type.

it might also open a can of worms for other gzip-able types... ? (i just suspect there might be alot still missing?)

Sorry, I don't really understand what you meant by that.

@fruitl00p
Copy link
Author

@alrra one of the libraries that gave us trouble (but we've removed it since then) is the https://github.com/justinrainbow/json-schema ( PHP based json schema parser) It might have been fixed though (we dropped it about a month ago)

What i meant with opening the floodgates: there might be alot of other MIME types still out there that might be missing from the list, and by allowing this one in, others might want theirs in too...
Does that clear it up?

@alrra alrra closed this as completed in 54477eb Aug 30, 2014
@alrra
Copy link
Member

alrra commented Aug 30, 2014

one of the libraries that gave us trouble (but we've removed it since then) is the https://github.com/justinrainbow/json-schema ( PHP based json schema parser) It might have been fixed though (we dropped it about a month ago)

@fruitl00p Thanks for letting me know (I've asked because in most cases so far, the media type didn't really matter).

What i meant with opening the floodgates: there might be alot of other MIME types still out there that might be missing from the list, and by allowing this one in, others might want theirs in too...

@fruitl00p If you find something else that is missing, feel free to open an issue or a pull request. We are quite open to new additions as long as they aren't very obscure.

@fruitl00p I've added the related configs in 54477eb. As for setting the media type, because we can't know exactly if the .json file will contain a JSON schema or just regular JSON, that will have to be done by the user, either by configuring Apache (see example), or from the level "beneath" the server (e.g.: from PHP).

If I've missed something, let me know. :)

@fruitl00p
Copy link
Author

Thanks @alrra ! I've noticed you also set the header to disallow caching ... Whats your reasoning behind this?

@alrra
Copy link
Member

alrra commented Sep 3, 2014

I've noticed you also set the header to disallow caching ... Whats your reasoning behind this?

@fruitl00p Yes, I gave it some thought, and even though JSON schemas aren't supposed to change that often, since it is a data interchange format, usually used in APIs (where people will make mistakes, especially in the beginning + the APIs might be used even in non-browser environments, where users can't clear the cache so easily), I thought it would be better to just set the header to disallow caching by default (there are complaints already about us being too aggressive with caching).

@fruitl00p Feel free to disagree with me, nothing is set in stone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants