Skip to content

Header parameters not supported? #117

Closed
@pawamoy

Description

@pawamoy

Describe the bug
It seems header parameters are not supported? Marking this as bug because it generates a traceback.

Traceback (most recent call last):
  File "/home/user/.local/bin/openapi-python-client", line 8, in <module>
    sys.exit(app())
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/typer/main.py", line 213, in __call__
    return get_command(self)()
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/typer/main.py", line 496, in wrapper
    return callback(**use_params)  # type: ignore
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/openapi_python_client/cli.py", line 91, in generate
    create_new_client(url=url, path=path)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/openapi_python_client/__init__.py", line 48, in create_new_client
    project = _get_project_for_url_or_path(url=url, path=path)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/openapi_python_client/__init__.py", line 31, in _get_project_for_url_or_path
    openapi = OpenAPI.from_dict(data_dict)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/openapi_python_client/openapi_parser/openapi.py", line 227, in from_dict
    endpoint_collections_by_tag = EndpointCollection.from_dict(d["paths"])
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/openapi_python_client/openapi_parser/openapi.py", line 44, in from_dict
    endpoint = Endpoint.from_data(data=method_data, path=path, method=method, tag=tag)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/openapi_python_client/openapi_parser/openapi.py", line 150, in from_data
    endpoint._add_parameters(data)
  File "/home/user/.local/pipx/venvs/openapi-python-client/lib/python3.7/site-packages/openapi_python_client/openapi_parser/openapi.py", line 136, in _add_parameters
    raise ValueError(f"Don't know where to put this parameter: {param_dict}")
ValueError: Don't know where to put this parameter: {'name': 'Content-Disposition', 'in': 'header', 'required': True, 'description': 'Name of the file to save', 'schema': {'type': 'string'}}

To Reproduce
Add a header parameter in your spec, try to generate a client from it.

Expected behavior
Header parameters would be supported. How? I don't know 😁

OpenAPI Spec File
I'm not sure I can share it. I'll try to give a minimal example later.

Desktop (please complete the following information):

  • OS: RedHat 7
  • Python Version: 3.7.8
  • openapi-python-client version 0.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions