openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

The request body in specification with `application/vnd.api+json` don't generate json option for request

Open penja opened this issue 3 years ago • 0 comments

Describe the bug The request body in specification with application/vnd.api+json don't generate json request paramers

To Reproduce Steps to reproduce the behavior:

  1. Example request body
requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/WorkspaceDocument'
  1. generate specification
  2. see in models
def sync_detailed(
    workspace: str,
    *,
    client: Client,
) -> Response[Union[Any, WorkspaceDocument]]:
    """Update a Workspace

    Args:
        workspace (str):

    Returns:
        Response[Union[Any, WorkspaceDocument]]
    """

    kwargs = _get_kwargs(
        workspace=workspace,
        client=client,
    )

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

    return _build_response(response=response)

Expected behavior request body with application/vnd.api+json should generate code like belowe

def sync_detailed(
    workspace: str,
    *,
    client: Client,
    json_body: WorkspaceDocument,
) -> Response[Union[Any, WorkspaceDocument]]:
    """Update a Workspace

    Args:
        workspace (str):
        json_body (WorkspaceDocument): JSON:API Document.

            see: https://jsonapi.org/format/#document-structure

    Returns:
        Response[Union[Any, WorkspaceDocument]]
    """

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

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

    return _build_response(response=response)

Desktop (please complete the following information):

  • OS: [e.g. macOS 10.15.1]
  • Python Version: [e.g. 3.8.0]
  • openapi-python-client version [e.g. 0.1.0]

Additional context Add any other context about the problem here.

penja avatar Mar 08 '22 15:03 penja