Tagged API methods vanish when using $ref parameters
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tagged API methods vanish when using $ref parameters
I'm trying to use $ref parameters YAML to represent a common body for multiple PUT/POST request documentation, but when I do, the API calls vanish alltogether, along with all other API calls with the same tag.
Using the following sample editor, when I click over to Interactive API Docs, the Blah API tag will appear, but the Foo API tag does not. If I remove the $ref from line 22, the Foo tag will appear in the interactive docs.
As far as I can tell, the syntax is correct, and I get the "valid {...}" message at the top of the API page.
I can duplicate the body definition (and am currently doing this), but it would obviously be more convenient to be able to use the common reference.
What am I doing wrong here?
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mrbalky,
It looks like your API definition is using a `get` method to send a body parameter--that's not allowed in a GET, you will have to use `put`, `post`, or `delete`. I'm guessing you really want a `post` operation, which should work just fine like this:
paths: '/api-public/v1/foo/{asdf}': post: tags: - Foo summary: "Do foo" description: Foo foo foo foo parameters: - name: asdf in: path type: string required: true - $ref: '#/parameters/qwerty' responses: '200': description: yeah
Please post back if you still have issues!
Tony Tam
SmartBear VP of Swagger Products
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
D'oh! Yep, you're right. POST is what I wanted.
Still have the problem, though. Here's without the $ref to '#/parameters/qwerty'
And here's with the $ref:
Thanks,
Charlie
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I believe there's indeed an issue with rendering referenced body parameter, regardless of the HTTP method and we'll need to look into resolving that. For now, the workaround would be to not reference such parameters and repeat them for each operation. We'll of course update you when a solution in the rendering is available.
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ron is correct, it does look like there's a bug. I've got it tracked in the swagger-ui project and we'll get this updated in SwaggerHub in just a bit. I'll post back here when it is.
Tony Tam
SmartBear VP of Swagger Products
