question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Semantic error for "in: formData" Parameters and proper "consumes"

See original GitHub issue

a ‘consumes’ property is defined as required in the top level, but editor shows error:

Semantic error at paths./path1.post Operations with Parameters of “in: formData” must include “application/x-www-form-urlencoded” or “multipart/form-data” in their “consumes” property

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-Editor version? latest online version
How did you install Swagger-Editor? using http://editor.swagger.io/#
Which broswer & version? chrome 63.0.3239.84
Which operating system? macOS 10.13.2

Demonstration API definition

swagger: '2.0'
info:
  title: 'Demonstration of "consumes" problem'
  version: v1
basePath: /
consumes:
  - application/x-www-form-urlencoded
  - multipart/form-data
paths:
  /path1:
    post:
      parameters:
        - name: param1
          type: string
          in: formData   
      responses:
        '200':
          description: ok

Expected Behavior

Error should not be displayed

Current Behavior

Error is displayed even though the swagger definition is valid

Possible Solution

Context

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shockeycommented, Mar 9, 2018

fixed (again!), thanks for the heads up @elasti-ron!

0reactions
elasti-roncommented, Feb 25, 2018

@shockey - thanks for fixing this earlier. It is now happening again. As I cannot reopen this issue, I’ve opened a new one (#1684).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameters cannot have both a "in: body" and "in: formData ...
I am using the latest OpenAPI feature. I've been able to produce a simple sample using the latest nugget packages that shows the...
Read more >
Swagger 2.0 semantic error with $ref to path parameter
The problem is that id is actually defined, only it appears that the check which throws this error is occurring before the $ref...
Read more >
OpenAPI Specification - Version 2.0 - Swagger
If type is "file" , the consumes MUST be either "multipart/form-data" , " application/x-www-form-urlencoded" or both and the parameter MUST be in "formData"...
Read more >
Best practices for REST API design - Stack Overflow Blog
Best practices for REST API design · Accept and respond with JSON · Use nouns instead of verbs in endpoint paths · Name...
Read more >
FormData - Web APIs | MDN
Chrome Edge FormData Full support. Chrome5. Toggle history Full support. Edge12. Toggl... @@iterator Full support. Chrome50. Toggle history Full support. Edge18. Toggl... FormData() constructor Full support....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found