I would like to use https://github.com/OpenAPITools/openapi-generator to generate a python sdk from the yaml behind https://api-docs.firefly-iii.org/
Currently, the YAML contains this securityScheme:
securitySchemes:
firefly_iii_auth:
type: oauth2
description: Default OAuth2 flow
flows:
authorizationCode:
authorizationUrl: https://demo.firefly-iii.org/oauth/authorize
tokenUrl: https://demo.firefly-iii.org/oauth/token
refreshUrl: https://demo.firefly-iii.org/oauth/token
scopes: {}
local_bearer_auth:
description: Optional Bearer token flow
type: http
scheme: bearer
The above schema is translated by openapi-generator to the following snippet in configuration.py:
class Configuration(object):
_default = None
def __init__(
self,
host=None,
discard_unknown_keys=False,
disabled_client_side_validations="",
server_index=None,
server_variables=None,
server_operation_index=None,
server_operation_variables=None,
access_token=None,
):
...
self.access_token = None
I'm start an openapi client with
configuration = openapi_client.Configuration(
host = os.environ["FIREFLY_III_API_URL"],
access_token = os.environ["FIREFLY_III_TOKEN"]
)
client = openapi_client.ApiClient(configuration)
Changing self.access_token = access_token makes authentication to work. Without it, the server returns an Unauthenticated error.
How could I extend the YAML schema to get the right generated code?