Skip to content

OpenAPI - Omitting nested optional fields in request requires conversion to Unknown of parent record #4618

@raphaelsolarski

Description

@raphaelsolarski

Currently if we want to invoke service with optional nested field in request body we have to convert the parent record to Unknown (e.g. by using #CONV.toAny(...)). After such a conversion we lose validation of possible other required fields in the parent record.

Example OpenAPI spec:

openapi: "3.1.0"
info:
  title: Simple API overview
  version: 2.0.0
paths:
  /customer:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                foo:
                  type: object
                  properties:
                    bar:
                      type: string
      responses:
        '200':
          description:
            Returns ComponentsByAccount.
          content:
            application/json:
              schema:
                type: string

Screenshot 2023-08-30 at 15 21 20
Workaround:
Screenshot 2023-08-30 at 15 21 43

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions