Skip to content
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

Semantic error is not reported #476

Open
bxsx opened this issue Feb 23, 2024 · 3 comments
Open

Semantic error is not reported #476

bxsx opened this issue Feb 23, 2024 · 3 comments

Comments

@bxsx
Copy link

bxsx commented Feb 23, 2024

Describe the bug

The semantic error reported by SwaggerEditor website is not reported by the Github Action

To Reproduce
Steps to reproduce the behavior:

  1. Define 2 endpoints
  2. Set the same value inoperationId

Expected behavior
Semantic error at paths./.get.operationId
Operations must have unique operationIds.

Screenshots
N/A

Additional context
Add any other context about the problem here.

  • Version: the latest release and the current master branch
  • Platform: swaggerapi/swagger-editor
@michaelnguyenm
Copy link

I'm also having this issue and I would like for this issue to be fixed as we'd like to detect when operationIds are not unique.

I tried playing around with the Swagger Editor Docker image and looking through the source code for this Github Action. I'm not super familiar with puppeteer, but it seems that after modifying localstorage with the openapi document, the puppeteer browser does a reload. This seems to be required because the content within the actual text editor will reload the content from localstorage (and is probably the easiest way to insert the text). Afterwards, the validator is then triggered, but it seems that only the structual

Here is a minimal document with one structural issue and one semantic error:

openapi: 3.0.0
info:
  title: Server API
  version: 1.0.0
servers:
  - url: https://{environment}.test.app/api
    variables:
      environment:
        default: api
        enum:
          - api
paths:
  asdf/admins/users/ban:
    post:
      summary: Ban a User
      description: Ban a User.
      operationId: PostAdminsUsersBan
      responses:
        "200":
          description: Successfully banned a user
  /admins/users/ban/invalidate:
    post:
      summary: Invalidate a Ban Record.
      description: Invalidate a Ban Records.
      operationId: PostAdminsUsersBan
      responses:
        "200":
          description: Invalidation Successful.

Once pasted into the Swagger Editor, these two errors appear:
image

Then if I refresh my browser OR if instead of the above, I inserted the document into my local storage and refreshed the browser after that, only this error will show up:
image

It seems that maybe on a page refresh or when loading content from localstorage, it is only validated for structural errors or some other related issue.

Wondering if @char0n has any thoughts on this to work around this or if it's a bug that would have to be have to be brought on https://github.com/swagger-api/swagger-editor ?

@swaroopar
Copy link

+1
same issue.

@char0n
Copy link
Member

char0n commented Jun 5, 2024

Well it looks like the error is in upstream SwaggerEditor@4 itself. If we fix it there, it's gonna be automatically fixed here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants