Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Mark form parameters as required when body is required #331

Merged
merged 2 commits into from
Mar 17, 2019

Conversation

skrysmanski
Copy link
Contributor

This pull request fixes the problem that when a form request body is marked as "required", then all form parameters should also be marked as "required".

For example, take this (shortened) input spec:

paths:
  /test_required:
    post:
      summary: Operation with form body that is required
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Category'

components:
  schemas:
    Category:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string

It results in 2 form parameters (id and name). Without this fix both parameters would be marked as "optional", even though the request body is marked as "required".

@HugoMario HugoMario merged commit e101a41 into swagger-api:master Mar 17, 2019
@HugoMario
Copy link
Contributor

awesome, thanks !!!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants