Skip to content

0.22.2 fails to validate *bool false (!)Β #158

Closed
@yktoo

Description

@yktoo

With the swagger spec:

    post:
      operationId: CommentModerate
      summary: Moderate the specified comment
      tags:
        - ApiGeneral
      parameters:
        - $ref: "#/parameters/pathUuid"
        - in: body
          name: body
          required: true
          schema:
            type: object
            required:
              - pending
              - approve
            properties:
              pending:
                description: Whether the comment is pending moderation
                type: boolean
              approve:
                description: Whether to approve the comment
                type: boolean
      responses:
        204:
          description: Comment has been updated

It apparently expects a true for the required fields (not quite sure). With 0.22.1 it would accept this request:

{
    "pending": false,
    "approve": false
}

With 0.22.2 the validation fails:

{
    "code": 602,
    "message": "body.approve in body is required"
}

I strongly suspect this change to values.go / Required() is the culprit: 348543c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions