For guidelines on creating custom or experimental Content-Type identifiers, see rfc6648.
Historically the recommendation was to prepend the identifier with "x-" but this has been deprecated. It sounds like the best practice is to try to ensure that you are registering your custom media type or using one that has already been registered (even if it's experimental)
As far as whether to use text/swagger
or application/swagger
I would suggest basing this off of the media type that Swagger uses which is JSON and since JSON is identified as application/json
then Swagger would be something like application/swagger+json
. Swagger can also include JSON Schema which is identified as application/schema+json
There's actually already a discussion on the Swagger mailing list that includes a proposal for application/swagger+json