-
-
Notifications
You must be signed in to change notification settings - Fork 260
Closed
Labels
✨ enhancementNew feature or improvementNew feature or improvement🍭 OpenAPI ComplianceSupporting a new bit of the OpenAPI specSupporting a new bit of the OpenAPI spec
Description
I'm using a third-party API which has this securityScheme:
components:
securitySchemes:
jwtAuth:
type: apiKey
in: header
name: Auth
and this path (redacted as it is not my API):
/auth/login:
put:
security:
- {}
tags:
- Authentication
requestBody:
content:
.
.
.
responses:
'200':
headers:
auth:
schema:
type: string
description:
format: jwt
The generated code for this API is:
@attr.s(auto_attribs=True)
class AuthenticatedClient(Client):
"""A Client which has been authenticated for use on secured endpoints"""
token: str
def get_headers(self) -> Dict[str, str]:
"""Get headers to be used in authenticated endpoints"""
return {"Authorization": f"Bearer {self.token}", **self.headers}
The desired code is:
@attr.s(auto_attribs=True)
class AuthenticatedClient(Client):
"""A Client which has been authenticated for use on secured endpoints"""
token: str
def get_headers(self) -> Dict[str, str]:
"""Get headers to be used in authenticated endpoints"""
return {"Auth": self.token, **self.headers}
Nov1kov and jollysahil
Metadata
Metadata
Assignees
Labels
✨ enhancementNew feature or improvementNew feature or improvement🍭 OpenAPI ComplianceSupporting a new bit of the OpenAPI specSupporting a new bit of the OpenAPI spec