Skip to content

rapidoc/components/schema: allow JSON schema content data #258

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

Closed
wants to merge 2 commits into from

Conversation

proppy
Copy link

@proppy proppy commented Jul 6, 2020

This change allow usage of <schema-tree> and <schema-table> custom element with a child <pre> block containing a JSON schema.

Example:

<schema-table>
   <pre>
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://example.com/product.schema.json",
  "title": "Product",
  "description": "A product from Acme's catalog",
  "type": "object",
  "properties": {
    "productId": {
      "description": "The unique identifier for a product",
      "type": "integer"
    }
  },
  "required": [ "productId" ]
}
   </pre>
</schema-table>

Fixes #253

Copy link
Collaborator

@mrin9 mrin9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an

  • example under the /docs/examples folder
  • associated spec under /docs/spec folder
  • link the example in /docs/list.html

@proppy
Copy link
Author

proppy commented Jul 13, 2020

  • example under the /docs/examples folder
  • link the example in /docs/list.html

[ ] associated spec under /docs/spec folder

Is this applicable since the json schema spec is meant to be inlined?

@mrin9
Copy link
Collaborator

mrin9 commented Jul 26, 2020

I tried to test the PR, but the example you added is not working

@proppy
Copy link
Author

proppy commented Jul 27, 2020

Seems to be related to WICG/webcomponents#809 (children are not guaranteed to be loaded when connectedCallback is executed).

proppy added 2 commits July 28, 2020 02:29
Act as a wrapper for `<schema-table>` and `<schema-tree>` to render
inline JSON schemas.

Fixes rapi-doc#253
@proppy
Copy link
Author

proppy commented Jul 27, 2020

PTAL

  • used <slot> to work around the issue.
  • changed the implementation to expose a new <rapi-schema> element that wrap <schema-tree> and <schema-table> and expose properties similar to <rapi-doc>.
  • rebased against master
  • regenerated dist/ and docs

@mrin9
Copy link
Collaborator

mrin9 commented Sep 15, 2020

will be revisiting json-schema support once OpenAPI v3.1.0 is releases and becomes little stable

@mrin9 mrin9 closed this Sep 15, 2020
@onavratil-monetplus
Copy link

Any chance to revisit this topic?

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

Successfully merging this pull request may close these issues.

Support for rendering individual JSON schema
3 participants