Skip to content
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

KafkaPublishInput missing swagger attributes #198

Open
vyshnevskyi opened this issue Jul 6, 2023 · 0 comments
Open

KafkaPublishInput missing swagger attributes #198

vyshnevskyi opened this issue Jul 6, 2023 · 0 comments

Comments

@vyshnevskyi
Copy link

vyshnevskyi commented Jul 6, 2023

As for now it's impossible for me to use KafkaPublish task due to swagger issue. I've added a KafkaPublishTask to my workflow, it looks like this:

def send_kafka_message_task(
    workflow_id: str,
    test_url: str,
    test_path: str,
    parameters: list[dict]
) -> kafka_publish.KafkaPublishTask:
    kafka_value = {
        'id': workflow_id,
        'triggeredBy': 'conductor',
        'test_url': test_url,
        'test_path': test_path,
        'parameters': parameters
    }
    kafka_task_input = kafka_publish_input.KafkaPublishInput(
        bootstrap_servers='kafka-broker:29092',
        topic='test_kafka_message',
        value=kafka_value
    )
    return kafka_publish.KafkaPublishTask(
        task_ref_name='send_kafka_message', kafka_publish_input=kafka_task_input
    )

Swagger fails to parse KafkaPublishInput since api client tries to access swagger_types and attribute_map attributes of KafkaPublishInput but there is none.

  File "/usr/local/lib/python3.9/site-packages/conductor/client/http/api_client.py", line 194, in sanitize_for_serialization
    for attr, _ in six.iteritems(obj.swagger_types)
AttributeError: 'KafkaPublishInput' object has no attribute 'swagger_types'

I propose to add swagger attributes to KafkaPublishInput same as we already have in HttpInput

class KafkaPublishInput:
    swagger_types = {
        '_bootstrap_servers': 'str',
        '_key': 'str',
        '_key_serializer': 'str',
        '_value': 'str',
        '_request_timeout_ms': 'str',
        '_max_block_ms': 'str',
        '_headers': 'dict[str, Any]',
        '_topic': 'str',
    }

attribute_map = {
        '_bootstrap_servers': 'bootStrapServers',
        '_key': 'key',
        '_key_serializer': 'keySerializer',
        '_value': 'value',
        '_request_timeout_ms': 'requestTimeoutMs',
        '_max_block_ms': 'maxBlockMs',
        '_headers': 'headers',
        '_topic': 'topic',
    }
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant