Skip to content

"No operations defined in spec!" is shown with path with $ref in 3.13.0 version #4350

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
jiguillen opened this issue Mar 20, 2018 · 8 comments

Comments

@jiguillen
Copy link

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? OpenAPI 3.0
Which Swagger-UI version? 3.13.0
How did you install Swagger-UI? Using swaggerapi/swagger-ui docker
Which browser & version? Chrome Versión 64.0.3282.186
Which operating system? Linux Mint 18 Sarah

Demonstration API definition

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets:
    $ref : './doc/paths/pets.yaml#/pets'
components:
  schemas:
    Pet:
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
    Pets:
      type: array
      items:
        $ref: "#/components/schemas/Pet"
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string

Configuration (browser query string, constructor, config.yaml)

Configuration by default in swaggerapi/swagger-ui docker

Expected Behavior

Can see /pets path

Current Behavior

"No operations defined in spec!" is shown

Possible Solution

It is was working in version 3.10.0

Context

I've updated from 3.10.0 to 3.13.0 version and it has stopped working.
File ./doc/paths/pets.yaml exists and it is well formed.

@jiguillen jiguillen changed the title No operations defined in spec! is shown with path with $ref in 3.13.0 version "No operations defined in spec!" is shown with path with $ref in 3.13.0 version Mar 20, 2018
@shockey shockey self-assigned this Mar 20, 2018
@shockey
Copy link
Contributor

shockey commented Mar 20, 2018

Thanks for the report, @jiguillen - I bumped into this while helping out on a support ticket, and have already started on a fix!

@shockey shockey added this to the Friday, March 23 milestone Mar 20, 2018
@shockey
Copy link
Contributor

shockey commented Mar 20, 2018

The depth option mentioned in #4280 would be helpful in limiting the performance hit we'll get from resolving path items at load time.

@glipman
Copy link

glipman commented Mar 20, 2018

I am not entirely sure if delayed resolving for paths is possible: a remote path item may define a tag.
Swagger UI uses tags to group the displayed operations. The resolved path item is needed even to display the collapsed items under the correct tag.

@shockey
Copy link
Contributor

shockey commented Mar 24, 2018

@glipman yeah, my solution is likely going to be check for $ref at the path level, and if it's there, go ahead and resolve.

Using https://gist.github.com/shockey/8c60fc810aa513fb27c9d4f025d0ac16 to test.

@shockey
Copy link
Contributor

shockey commented Mar 28, 2018

fixed! thanks for the report, @jiguillen 👍

@heldersepu
Copy link
Contributor

I noticed that this No operations defined in spec! also shows when we use the filter
http://petstore.swagger.io/?filter=NoOp
Every time we search for something that does not exist that is what we get...

@shockey
Copy link
Contributor

shockey commented Mar 28, 2018

@heldersepu, yeah that's been around since 3.0.0 I believe. it's a different root cause: the filter is modifying the output of a selector (taggedOperations iirc), so that when no operations match, the data flowing into the component is indistinguishable from a definition that has no operations.

There's ways to fix that, but they aren't closely related to this issue 😄

@lock
Copy link

lock bot commented Jul 2, 2019

Locking due to inactivity.

This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.

If you think you're experiencing something similar to what you've found here: please open a new issue, follow the template, and reference this issue in your report.

Thanks!

@lock lock bot locked and limited conversation to collaborators Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants