Using $ref in an example block
See original GitHub issueHi, I’m using a $ref
in an example block and everything works almost exactly how I want except for this one behavior.
The definition looks like this:
SubscriptionType:
[...]
example:
autorenew: true
cycle_days: 30
id: 33920
name: "my 1337 subscription"
terms:
- $ref: '#/components/schemas/SubscriptionTypeTerm/example'
But the output looks like this
{
"autorenew": true,
"cycle_days": 30,
"id": 33920,
"name": "my 1337 subscription",
"terms": [{
"description": "every 3 months",
"enabled": true,
"id": 33922,
"name": "3monthly",
"num_cycles": 3,
"subscription_type_id": 33920,
"$$ref": "#/components/schemas/SubscriptionTypeTerm/example"
}]
}
It’s everything that I want except I don’t want the "$$ref": "#/components/schemas/SubscriptionTypeTerm/example"
at the bottom of the object.
Am I missing something obvious or am I using refs incorrectly?
Possibly related: https://github.com/swagger-api/swagger-ui/issues/4021
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to correct a #REF! error - Microsoft Support
The #REF! error shows when a formula refers to a cell that's not valid. This happens most often when cells that were referenced...
Read more >Manipulating the DOM with Refs - React Docs
How to access a DOM node managed by React with the ref attribute; How the ref JSX attribute ... In this example, clicking...
Read more >Get a Ref to BlockListBlock in the block editor - Stack Overflow
You should use useRef instead, createRef won't save the value between re-renders. You can't track it on the useEffect .
Read more >Cross-referencing with Sphinx - Read the Docs
The numref role is used to reference numbered elements of your documentation. For example, tables and images. To activate numbered references, add this...
Read more >reStructuredText Primer - Sphinx documentation
Literal code blocks (ref) are introduced by ending a paragraph with the special marker :: . The literal block must be indented (and,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So what you actually want is to include the examples from your
$ref
to be included in your example, and recursively so.So I found a way around this. Instead of adding a completely separate
example
block I just add examples to every field in the component definition.Example:
Below works
Below results in
$$ref