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

Including multiple body parameters on operation doesn't result in error #1235

Closed
connorpwilliams opened this issue Jun 17, 2020 · 4 comments · Fixed by #1240
Closed

Including multiple body parameters on operation doesn't result in error #1235

connorpwilliams opened this issue Jun 17, 2020 · 4 comments · Fixed by #1240
Assignees
Labels
cs/reported t/bug Something isn't working

Comments

@connorpwilliams
Copy link

connorpwilliams commented Jun 17, 2020

Describe the bug
Developing API specifications in Stoplight Studio V1 does not identify OAS file issues. When my team imports this into our API management tool, the specification is checked with what I'm guessing is an implementation of swagger as it appears very closely similar to https://editor.swagger.io.

To Reproduce
I cannot copy content here as the APIs are company data which cannot be published. But one example is using an OpenAPI V2 specification - setting an attribute in a request JSON body to be data type "string" or "number" is not identified as an issue but it is identified as an issue with multiple types being invalid.
** EDIT **
Another issue that can come up is duplicate "in":"body" parameters for an API route. This is not identified as an issue but is indeed invalid.

Expected behavior
Invalid OAS 2 syntax is identified.

Screenshots
For security reasons I cannot attach screenshots.

Environment (remove any that are not applicable):

  • Library version: 5.4.0-beta1 (Built-in with Stoplight Studio V1)
  • OS: Windows 10
  • Browser: Version 83.0.4103.97 (Official Build) (64-bit)

Additional context
I am not sure if there is a difference between OpenAPI and Swagger. My team faces issues Daily when importing de-referenced API specifications from Stoplight Studio to our API Management platform. My team indicated that this issue was not happening with Stoplight Next.

@connorpwilliams connorpwilliams added the t/bug Something isn't working label Jun 17, 2020
@rossmcdonald rossmcdonald changed the title OAS files are invalid when using with swagger. Including multiple body parameters on operation doesn't result in error Jun 17, 2020
@rossmcdonald
Copy link
Contributor

@thecpdubguy I've made this issue specific to the multiple body parameters, as that's definitely an issue. For more context on the multiple types issue in OAIv2, see https://github.com/stoplightio/studio/issues/388 for more information. I may end up opening a separate issue for that with regards to Spectral, but let me sync with the team first.

@P0lip P0lip self-assigned this Jun 20, 2020
@P0lip
Copy link
Contributor

P0lip commented Jun 20, 2020

It seems like we report the error, yet the error message is a bit poor and doesn't really point at the actual problem in the document, therefore one can miss it - in fact, I couldn't locate it at first glance either.
We report multiple body parameters as <position> <severity> operation-parameters Operation parameters are unique and non-repeating., and since the error points at given http operation in the document rather than the actual parameter, it's easy to miss.
I'll improve the error message as well as provide a more accurate location, so it's easier to spot the problem.

@connorpwilliams
Copy link
Author

I don’t recall seeing this type of a warning. I’ll check when I’m back at work on Monday. I do know that multiple parameters are caught if there’s two parameter blocks, one at an operation level and one at a path level. For Example, the path parameter object has accountId path parameter and so does the GET operation. Maybe I’ve blended them together in my head.

@P0lip
Copy link
Contributor

P0lip commented Jun 23, 2020

I tweaked the error reporting - the new errors will be more meaningful and detailed.
The change will be released in 5.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cs/reported t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants