Giter Site home page Giter Site logo

Comments (2)

jeremyfiel avatar jeremyfiel commented on May 26, 2024

Can you give an example OAS description and your expected behavior?

Sounds like you want to externalize your schemas, which can be done a multitude of ways.

First, you can use OAS 3.1.0 and only define the components section and then reference the components from other OAS descriptions .

# components-only.yaml
openapi: '3.1.0'
info:
  title: test
  version: '1.0.0'
components:
  schemas:
    yourSchemaHere: {}
    anotherSchemaThere: {}
# my-real-api.yaml
openapi: '3.0.3'
info:
  title: test
  version: '1.0.0'
paths:
  '/thing':
    get:
      responses:
        '200':
          description: a response with a reference to a components only file
          content:
            'application/json':
              schema:
                $ref: 'components-only.yaml#/components/schemas/yourSchemaHere'

Secondly, you can use external JSON Schema schemas. these can be written in JSON or YAML

openapi: '3.1.0'  either OAS 3.0.x or 3.1.x will work with external JSON Schema schemas. 
info:
  title: test
  version: '1.0.0'
components:
  schemas:
    yourSchemaHere: 
      $ref: 'yourSchemaHere.schema.json#'
    anotherSchemaThere: {}
## filename:  "yourSchemaHere.schema.json"
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "yourSchemaHere",
  "type": "object",
  "properties": {
    "some_prop": {}
  }
}
# a yaml variation of the same JSON Schema.   "yourSchemaHere.schema.yaml"
$schema: 'https://json-schema.org/draft/2020-12/schema'
title: yourSchemaHere
type: object
properties:
  some_prop: {}

from redoc.

kylejmcintyre avatar kylejmcintyre commented on May 26, 2024

Thanks for the response! We're already making heavy use of components/refs in our OAI schema. Let me try to give a more descriptive version of the feature which is probably off-base but hopefully illustrative:

  • Support an extension property like `x-redoc-exposed-component-tag' that would take a tag value like operations do
  • redoc discovers components with the above tag and adds that as a top-level entry in the redoc UI under the appropriate tag (regardless of whether or not the component is referenced directly or indirectly by an op),
  • Instead of having an HTTP Verb or 'Event' as their descriptor, it just says something like 'Object', 'Schema' or 'Component'.
  • Basically we really like your drilldown for exploring schemas and want to leverage it without having to declare an operation (API or webhook)

Here's an example where I'm declaring something as a webhook that really isn't so that people can explore the object schema. We'd like to use this for a variety of purposes including documenting analytic events (not webhooks), data dictionaries & objects that are used in our scripting framework.

from redoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.