Skip to content

Header parameters not supported? #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pawamoy opened this issue Aug 3, 2020 · 3 comments · Fixed by #148
Closed

Header parameters not supported? #117

pawamoy opened this issue Aug 3, 2020 · 3 comments · Fixed by #148
Labels
✨ enhancement New feature or improvement
Milestone

Comments

@pawamoy
Copy link

pawamoy commented Aug 3, 2020

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
@pawamoy pawamoy added the 🐞bug Something isn't working label Aug 3, 2020
@dbanty
Copy link
Collaborator

dbanty commented Aug 3, 2020

@pawamoy thanks for reporting! I believe you won't get an exception anymore on the main branch (what will be 0.5.0 eventually). It still doesn't support header params yet, so it will probably skip that endpoint, but hopefully you won't get a traceback anymore.

@dbanty
Copy link
Collaborator

dbanty commented Aug 6, 2020

@pawamoy have you been able to try header parameters with 0.5+ yet? If it just skips instead of crashing I think this can move from bug to enhancement.

@pawamoy
Copy link
Author

pawamoy commented Aug 6, 2020

Yes it skips correctly, no traceback :)

@dbanty dbanty added ✨ enhancement New feature or improvement and removed 🐞bug Something isn't working labels Aug 6, 2020
@dbanty dbanty added this to the 0.5.3 milestone Aug 10, 2020
emann added a commit to emann/openapi-python-client that referenced this issue Aug 10, 2020
dbanty pushed a commit that referenced this issue Aug 11, 2020
* Added support for Header parameters (#117)

Co-authored-by: Ethan Mann <emann@triaxtec.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants