JsonSchemaViewer does not respect showSideNav attribute.
I'm trying to inject following html to tag description. Theme and header attributes works as expected but I cannot hide the side nav.
<json-schema-viewer
spec-url="data:;base64,;..."
theme="light"
show-header="false"
show-side-nav="false">
</json-schema-viewer>
And why? Well, we have websocket on same server and I like to just list event payloads in description. Keeping all the stuff in same apidoc feels better than docs scattered all over the places.
And why? Well, we have websocket on same server and I like to just list event payloads in description. Keeping all the stuff in same apidoc feels better than docs scattered all over the places.
OpenAPI do not support documenting WebSocket. So unfortunately you cant
And <rapi-doc> and <json-schema-viewer>are two different web-components made for different purposes you cannot apply rapidoc's attribute to json-schema-viewer and expect it to work
json-schema-viewer is not yet made public nor we provide any documentation or usage example for this component. It is intended to show certain schema documentations that are loosely based on json-schema spec, such as MongoDB / DocumentDB, Elasticsearch / OpenSearch, Avro Schema etc.
Still if you like to document WebSockets using OpenAPI, IMO using markdown and use a table or code-block in descriptions to document your schemas and related details. That way you can have the entire spec in one document.
And the other option would be to use AsyncAPI to document your REST API and WebSocket both in a single place
OpenAPI do not support documenting WebSocket. So unfortunately you cant
Well, I didn't suggest or ask for WebSocket support. I'm just asking if it's possible to render any json schema to the description.
json-schema-vieweris not yet made public nor we provide any documentation or usage example for this component. It is intended to show certain schema documentations that are loosely based onjson-schemaspec, such as MongoDB / DocumentDB, Elasticsearch / OpenSearch, Avro Schema etc.
If you have intend to publish a
okay I will add this to our queue as a feature request. to allow usage of json-schema-viewer component inside of the rapi-doc component in a more structured way
@nnaku how were you able to pass the schema via the data URL? I'm trying the same and getting error RapiDoc: There was an issue while parsing the spec with:
{
errors: [],
resolvedSpec: { /* my correctly decoded json schema */ },
spec: {}
}
@shishkin here is how i got it working. Its from internal tool so no live example sorry...
const markdownTemplate = ({title, description, spec}) => `
### \`${title}\`
${description}
<div class="event-schema" style="height: auto;">
<json-schema-viewer
spec-url="data:;base64,${Buffer.from(JSON.stringify(spec), 'utf8').toString('base64')}"
theme="light"
show-side-nav="false"
show-header="false"
show-info="false"
allow-search="false"
allow-advanced-search="false">
</json-schema-viewer>
</div>
`
OK, after some debugging it seems the issue I had wasn't with the base64 data URL encoding, but with the expected spec format. From this mongo example and the parser logic I see that json-schema-viewer expects some weird structure like:
jsonSchemaViewer: 1.0.0
schemaAndExamples:
// real schema goes in here
Is this some kind of standard? Can the json-schema-viewer just accept a plain JSON schema as input?