Comments (2)
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.
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)
- Update sample to use Museum API
- DownloadDefinitionUrl for multiple OpenAPI specs HOT 2
- Schemas based on ref get incorrectly replace at bundle time HOT 4
- Fixing Vulnerability CVE-2023-43787 HOT 3
- Feature Request and Implementation for Multi-Level Tag Grouping HOT 3
- High-severity Vulnerability in browserify-sign - redoc-cli Version 0.13.21 HOT 1
- Reports unsupported specification when supplying it directly
- Decorators not running with build-docs but do in docs-preview
- Black area in Redoc interface is covering the information in the central area
- Use a local file for spec-url HOT 1
- Strange rendering of Markdown when headers has similar text HOT 1
- Fixing vulnerability CVE-2023-52425 and CVE-2024-25062 HOT 1
- Improve order of drop-down items when using discriminator (since #1462 is closed) HOT 2
- Bullet Tech HOT 2
- Downloaded file does not include referenced definitions
- Redocly Rules with Ruleset ID does not match the URL
- The schema switch is not working in Firefox HOT 1
- Prototype Pollution Vulnerability Affecting redoc module, versions [2.0.0-rc.54,2.0.0-rc.75], [2.0.0,2.1.3]
- Announcement: Redoc Roadmap
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redoc.