Skip to content

The requestBody declared with $ref is not generating json_body #595

Closed
@RockyMM

Description

@RockyMM

Describe the bug
If a requestBody is declared with a $ref, then no json_body property is generated. If the reference is inlined, then json_body is generated.

To Reproduce
Steps to reproduce the behaviour:

  1. Example schema:
paths:
  "/objects":
    post:
      operationId: object_create
      requestBody:
        $ref: "#/components/requestBodies/Object"

  1. generated API is:
def sync_detailed(
    *,
    client: Client,
) -> Response[Object]:
    """
    Returns:
        Response[Object]
    """

    kwargs = _get_kwargs(
        client=client,
    )

    response = httpx.request(
        verify=client.verify_ssl,
        **kwargs,
    )

    return _build_response(response=response)

Expected behavior
The expected API should be:

def sync_detailed(
    *,
    client: Client,
    json_body: Object,
) -> Response[Object]:
    """
    Args:
        json_body (Object):

    Returns:
        Response[Object]
    """

    kwargs = _get_kwargs(
        client=client,
        json_body=json_body,
    )

    response = httpx.request(
        verify=client.verify_ssl,
        **kwargs,
    )

    return _build_response(response=response)

OpenAPI Spec File
test.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions