OpenAPITools / OpenAPITools/openapi-generator
[REQ] Clarify types for keys and certs
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I want to use a client key/cert pair with the python client.
I can see in the generated configuration.py file
class Configuration(object):
...
def __init__(self, ...):
...
self.ssl_ca_cert = None
"""Set this to customize the certificate file to verify the peer.
"""
self.cert_file = None
"""client certificate file
"""
self.key_file = None
"""client key file
"""
It is not clear what I should be passing to these properties.
Do I pass:
- a string of a file path to a key/cert on disk e.g.
self.cert_file = '/tmp/cert.crt' - a file-like byte object e.g.
self.cert_file = open('/tmp/cert.crt', 'rb') - a file-like str object e.g.
self.cert_file = open('/tmp/cert.crt', 'r') - a byte array of the cert/key content, e.g.
self.cert_file = open('/tmp/cert.crt', 'rb').read() - a string of the cert/key content, e.g.
self.cert_file = open('/tmp/cert.crt', 'r').read()
Describe the solution you'd like
The comments next to self.cert_file, self.key_file and self.ssl_ca_cert should specify which subset of the above 5 options are allowed.
It would also be great if I could specify those things inside Configuration's __init__, like for username and password.
(Noting that I'm using an OpenAPI 2.0 spec, which doesn't have a way of specifying client key usage in the spec.)
Describe alternatives you've considered
Documentation in the highest level generated README.md would also be good. But hard to do since you can't specify client key usage in the spec.
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated configuration.py comments for ssl_ca_cert, cert_file, and key_file, then check the generated top-level README.md guidance. Confirm which value forms the Python client accepts and document those forms, including whether Configuration's init should expose them; done means the generated documentation answers the listed usage questions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100