Skip to content

Display examples in other mime types than defaults #886

Open

Description

@sroucheray

Today only examples provided with a mime type containing json | xml | text | jose are rendered. I think it is a bit limitative. I have examples with other mime type contents that could be displayed because they are plain text but their mime types are not whitelisted (e.g: application/n-triples).
I see several solutions to the problem but I would like to know your point of view on the subject @mrin9 :

1 - add other mime types to the list, but it does not scale
2 - add a component attribute to specify other mime types that can be displayed as string, it seems very technical and we should be able to infer proper default without a user input
3 - add a component property which should be a function taking a mime type and a content an returning a formatted html string, this should be useful to render various mime types but maybe it is again too much technical
4 - remove the test on mime types altogether considering that if an example is provided it must be a literal so can be displayed in the browser https://spec.openapis.org/oas/v3.1.0#fixed-fields-15, but those tests are here so maybe they are useful https://github.com/rapi-doc/RapiDoc/blob/master/src/components/api-request.js#L775

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions